Solutions to End of Chapter Problems Problem 1: #include <stdio.h> int main( ) { char init1, init2; printf("Please enter your initials: "); scanf("%c %c", &init1, &init2); printf("Thank you %c%c for using the program\n", init1, init2); } Problem 2: #include <stdio.h> int main( ) { float tempF, tempC; printf("Please enter your Fahrenheit temperature: "); scanf("%f", &tempF); tempC = (5.0/9.0)*(tempF - 32.0); printf("The equivalent Celsius temperature is %f. \n", tempC); } Problem 3: (a) See the picture of the directory structure on page 44. If we go up one directory (by typing cd .. ) we arrive at the home directory. Typing ls shows us all the folders in the /home directory. Each of these folders corresponds to a user. Thus, we see there are four users: instructor , joe , mia , midshipman. (b) See the picture of the directory structure on page 44. If we move up from the /home directory we arrive at the root directory. When I type ls I count 23 items. Problem 4: Line-by-line: (3 * 4) + (2 * 4) + (2 * 1) = 22 bytes total Problem 5: In the printf statement, the variable named favoriteNumber which we would like to print out has been incorrectly typed in as favorite_Number (i.e., with an extra underscore). Problem 6: (a) /home/bob (b) /home/instructor/cyber/lesson5 (c) ../instructor/cyber/lesson5 (d) ../.. Problem 7: (a) Machine code (b) High-level code Problem 8: (a) In the printf statement, the variables init2 and init1 are in the wrong order and should be reversed. (b) This is a logic error. 6 (c) assembly code