/* MAE 9: Final Exam, Fall 2005 Due on Monday, December 5th, before 10:00 pm Use this template as a starting point for your final. Add code for the 3 void functions at the bottom. Add additional functions after each prob(). For example, if you are adding a function for prob2(), write the function bewteeen prob2() and prob3() below. The function prototypes can be in any order. You do not need to change anything in main(). Your entire final should be one large C program, and should be turned in as usual. */ #include #include /* function prototypes */ void prob1(void); void prob2(void); void prob3(void); main() { int menu; printf("Enter the function number to execute (1-3):"); scanf("%d", &menu); switch(menu){ case 1: prob1(); break; case 2: prob2(); break; case 3: prob3(); break; default: printf("prob%d() does not exist.\n", menu); } exit(0); } void prob1(void) { /* Put prob1 here */ } void prob2(void) { /* Put prob2 here */ } void prob3(void) { /* Put prob3 here */ } /* The assigned problems are: prob1(): Compute the first 35 elements of an integer sequence defined by a recursive relation: n[i+2] = 2*n[i+1]-n[i]+5, with n[0]=1 and n[1]=2. Print the computed elements on the terminal screen, 5 per line, using the format %10d. Then, compute the quantity R = (n[25]-n[24])/n[25] by using double floating-point values and print the result on the terminal screen by using the format %11.5f. ...................... prob2(): By using the functions calloc() or malloc() allocate memory to store n integer values in int *v. Suppose n=6. Enter 6 integer values randomly from the keyboard and save them in int v[]. Print the components of the vector v[] on the screen. Rearrange the components of v[] in ascending order starting from the smallest number. Print the components of rearranged v[] on the screen and in the data file "vector.dat". ........................... prob3(): The elements of the (4x3) matrix are b[i][j]=1.5*(i+2)*(j+1). Use the calloc function and pointer to pointer **b to allocate the memory space for the matrix. Pass the pointer to pointer to the function trans_matrix(double **b,int rows,int cols) which will transpose the matrix. Print the original and the transpose matrix. Print the memory address of b[1][2]. */