Exercises
1. Which of the following are invalid constants? Why?
123.456 0x10.5 0X0G10001 0xFFFF 123L0Xab05 0L -597.25123.5e2 .0001 +1298.6F 98.7U 17777s0996 -12E-12 077771234uL 1.2Fe-7 15,0001.234L 197u 100U0XABCDEFL 0xabcu +123
2. Write a program that converts 27° from degrees Fahrenheit (F) to degrees Celsius (C) using the following formula:
C = (F - 32) / 1.8
Note that you don’t need to define a class to perform this calculation. Simply evaluating the expression will suffice.
3. What output would you expect from the following program?
Get Programming in Objective-C, Sixth Edition now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.