LAST Name FIRST Name Points... 25 points total. (1) is worth 5 points. (2) 10 points. (3) 6 points. (4) 4 points. (1) Give C code to (a) ask the user how many numbers they want to enter, (b) ask the user for those integers, and (c) compute and print the average of all the numbers entered. Use correct spelling (including upper/lower case) and punctuation. Give the complete program, including the #include's. #cindsalfkjalsjdf int main() { printf("How many? "); int n, N; scanf("%i",&n); N = n; double total=0, num; for(; n > 0; n--) { printf("Num: "); scanf("%lf", &num); total += num; } printf("%lf\n", total / N); return 0; } (2) Random questions about C. For questions about syntax, give the exact correct spelling/capitalization (e.g., int, not Integer or integer). (2a) What are the two types that can be used to store floating point numbers in C, and what is the difference between them? double - 64 bits float - 32 bits (2b) Name 3 different types that are used in C to store integers, and what is the difference between them? char - 1 byte short - 2 bytes int - 4 bytes long - 8 bytes unsigned any of those (2c) What are the smallest and largest possible values of a signed char? Of an unsigned char? Of an int? unsigned ... 2^(# bits) - 1 signed ... -2^(# bits - 1) -> 2^(# bits - 1) - 1 (2d) Write how you would declare a pointer to an integer in C. int *x; (2e) Evaluate each of the following: 30 in binary is 11110 13 in binary is 01101 30 & 13 = 01100 = 12 30 && 13 = 1 30 | 13 = 11111 = 31 30 || 13 = 1 30 ^ 13 = 10011 = 19 (3) What does the code do? For each, keep track of what the values of the variables are, and the final printed result. (3a) Functions and pointers void fun(int *x, int *y, int z, int w[]) { z = *x; *x = *y; *y = z; w[0] = *x; w[1] = *y; w[2] = z; } int main() { int a=1, b=2, c=3, d[3] = {4, 5, 6}; fun(&a, &b, c, d); printf("%i, %i, %i, %i\n", a, b, c,d[1]); } /* Variables: Printed on screen: */ (3b) Arithmetic int x = 3, y = 2; float z = x * y; x = x + y * 3; y = y / 3 + y; y = (x + y) % 4; z = z / 4.0; printf("%i\n%i\n%f\n", x, y, z); // x: // // y: // // z: // Printed on Screen: (3c) Loops int i = 0; int x = 200; printf("%i, %i\n", i, x); for(; i*i <= 16; i++) { printf("%i, %i\n", i, x); x /= 2; } printf("%i, %i\n", i, x); // i: // // x: // // Printed on Screen: (4) Random questions from the "CS Memorize" document... NOTE: for this problem, ^ is exponentiation even though ^ is not exponentiation in C. For example, for this problem, 2^3 is 2*2*2 = 8. (4a) Give the exact value for the sum 1 + 2 + 3 + ... + 50. (4b) Give the exact value for the sum 1 + 1/3 + 1/9 + 1/27 + ... + 1/(3^10) (4c) How many megabytes are in one gigabyte? How many megabytes are in one terabyte? (4d) What is the value of log, base 2, of (2^10) ?