I'm having difficulties with this assignment. I thought I was doing it correctly but unfortuneatley I'm receiving parse errors. I'm writing this program in SSH Secure Shell.

Here is my current code;

It seems as though my looping is not working correctly....Code:#include <stdio.h> #include <math.h> #define pi 3.141592 main() { int degree, q, a, b, c, d; double x, y, y2, z; printf("Enter angle in degrees:\n") ; scanf("%d", °ree) ; x = ((pi*degree)/180) ; y=cos(x); printf("True value of cos(x) is %d\n",y); char ch; do { printf("Enter a character; 0 to exit\n"); ch = getchar(); getchar(); switch(ch) { case 'a': y2=(y-((x*x*x*x*x*x)/(6*5*4*3*2*1))); case 'b': y2=(y+((x*x*x*x)/(4*3*2*1))); case 'c': y2=(y-((x*x)/(2*1))); case 'd': y2=(y); } if (ch = a) printf("4 term approximation\nApproximate cos(x) = %f\nRelative erro r = 20 percent", y2); } while (ch != 'q'); exit(z); }

My Parse Errors;

And last but not least this is my assignment....Code:Enter angle in degrees: 45 True value of cos(x) is -1073081832 Enter a character; 0 to exit 0 Enter a character; 0 to exit 0 Enter a character; 0 to exit 0 Enter a character; 0 to exit 0 Enter a character; 0 to exit 4 Enter a character; 0 to exit 3 Enter a character; 0 to exit 2 Enter a character; 0 to exit 1 Enter a character; 0 to exit Stopped

Code:Scan the angle in degrees x_deg (=45). Express this angle in radians by using x=PI*x_deg/180, and calculate Y=cos(x) by using the math.h library of functions. Your objective in this quiz is to compare the so caclulated value of Y=cos(x) with the approximate value y obtained by using 1, 2, 3, and 4 leading terms of the Taylor series: cos(x) = 1 - x^2/2! + x^4/4! - x^6/6! + ... Recall that k!=k*(k-1)*(k-2)* ... *3*2*1 . Use a do/while loop in conjunction with a switch statement switch(ch). Enter the character '1' for one term approximation '2' for two terms, etc., by using getchar() function. Use '0' to exit the program. Let your opening case calculate the fourth term x^6/6!, let the subsequent case calculate the x^4/4! term, etc. (In this way, you wan't need to use a break statement within your switch). Evaluate the corresponding Y , print the result in one line, and the relative error (Y-y)/Y in another line. Execute your program for all four cases (with corresponding printouts). Note: To avoid printing on the screen: Enter a character; 0 to Exit twice in a row, insert the line getchar(); after each of the lines scanf("%lf",&x_deg); and n_term=getchar(); in your program. ............................................ Your output should look like this: True value of cos(x) = 0.707107 Enter a character; 0 to Exit 1 1 term approximation Approximate cos(x) = 1.000000 Relative error = -41.421356 percent Enter a character; 0 to Exit 2 2 terms approximation Approximate cos(x) = 0.691575 Relative error = 2.196545 percent Enter a character; 0 to Exit 3 3 terms approximation Approximate cos(x) = 0.707429 Relative error = -0.045598 percent Enter a character; 0 to Exit 4 4 terms approximation Approximate cos(x) = 0.707103 Relative error = 0.000504 percent Enter a character; 0 to Exit 0 */

Thanks for any feedback,

-Steve