CSE102#hw04 solution


Original Work ?


5/5 - (2 votes)

In this homework you will write programs to exercise with loops, functions and pointers. Please do not forget that your program should work exactly as the example runs given below the part definitions. Submit your homework via KADI. #part1 In this part of the homework, you will use Taylor series to calculate sine and cosine. ????= (−1)* 2?+1!?.*/01* 23 =?−?4 3!+?6 5!−⋯??? ??? ? ????= (−1)* 2?!?.*1* 23 =1−?. 2!+?@ 4!−⋯??? ??? ? The user will enter an integer as degree and another integer that defines the first n elements of the series. You are not allowed to use math library functions for calculations, that is you must write your own functions with the same input/output format of the math library function. In addition, use the following function signatures to make your program modular:
double cosine(int degree, int n); double sine(int degree, int n); void getInputs(int* degree, int* n, int* exit);
The function named getInputs will wait for user to enter the degree and n value. If ‘E’ is entered instead, the exit variable will be 1, otherwise 0.