Question: Write C programs for the following: 1. Pretending that the cosine function, cos( x ) , is not available in the C compiler, create your

Write C programs for the following:1. Pretending that the cosine function, cos(x) , is not available in the C compiler, create your own cos(x) using

cos (x) = 1 x22! + x44! x66! +

Backgroundand demonstrate your program by making a table as:

x mycos(x) cos(x)
0.0 1.000 1.000
0.1 1.101 1.105
0.2 1.308 1.221
... ... ...
1.0 1.69 1.781

where mycos(x) is from your program and cos (x) is the C-supplied function in math.h.Note:

The values above are false.

The following is the general form of cos (x).

cos(x) = i=0 (1)i x2 i(2 i)! ,

Take first 10 terms for the series.

Template:

#include  #include  int factorial(int n) { (your code here) } float mycos(float x) { float sum=0; int i; for (i=0;i<=10;i++) sum = sum + (your code here); return sum; } int main() { float ...; int i=1; /* counter */ (for i=1;i< .......) printf....... return 0; } 

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!