CS 1713, Intro. to Computer Science, Exam 1 (25) 1. Consider the following command entered on runner: runner% cc -o prog prog.c (a) Explain with just one word what the command is doing. (b) What is the reason for "-o prog" (what purpose does it serve)? (c) How would you execute the program produced by this command? (d) Show how to execute this program and to use redirection to send the output to a file named outfile rather than to the terminal. (25) 2. Insert code into the C program below so that it will print the Centigrade temperature corresponding to an input value for the Fahrenheit temperature. You need to supply the prototype and definition of a function ftoc, which takes a double representing Fahrenheit as its input parameter and returns the Centigrade temperature using the formula: C = (5/9)(F - 32). #include /* prototype for function ftoc here*/ void main(void) { double F, C; scanf("%lf", &F); C = ftoc(F); printf("Fahrenheit: %.2f = Centigrade: %.2f\n", F, C); } /* insert definition of ftoc here */ (25) 3. Write a complete C program which will do the following: · declare a variables n. · read a value for n, using scanf. · use a while loop to print the odd integers from 1 to n, including n if n is odd, printing them on one line with a single blank between each number. (25) 4. Consider the following table of grades based on numerical averages: Average Grade --------- --- 90-100 'A' 80-89 'B' 70-79 'C' 60-69 'D' 0-59 'F' Otherwise 'N' Write a complete C program that will use scanf to read a value for the integer variable ave, and will use an if-else to give a char variable grade the correct letter, based on this table. Then the program should print the values of ave and grade, using a %c format for a single character.