main() { printf("Hello, world\n"); }The program above prints "Hello, world" (without the quotation marks) and a new line when you run it. Copy the program into a file, and run it. Experiment with leaving out parts of the program to see what error messages you get.
You can visit the Common C Compiler Errors page to see what error messages you'd get if you are compiling the program using gcc running on Solaris. The error messages you actually get may be different if you compile the program using a different compiler.
Exercise 2
Experiment to find out what happens when printf's argument string contains \c, where c is some character not listed in Lecture 1.
Exercise 3
Use the formula C = (5/9)(F-32) to convert Fahrenheit temperatures (F) to Celsius (C). Use values of F in the range 0 <= F >= 300, in steps of 20. Your output should look like:
0 -17 20 -6 40 4 60 15 80 26 100 37 120 48 140 60 160 71 180 82 200 93 220 104 240 115 260 126 280 137 300 148The solution is here, or else you can mail me.
Exercise 4
Modify the temperature conversion program to print a heading about the table. The solution is here, or else you can mail me.