#include <stdio.h>
#include<math.h>
int main() {
float angle,x;
float deno,numer,sum,term;
int i,n;
printf("enter the angle:\n");
scanf("%f",&angle);
printf("enter the value of n:\n");
scanf("%d",&n);
x=angle*M_PI/180;
numer=x;
deno=1;
sum=0;
term=numer/deno;
for(i=1;i<=n;i++)
{
sum=sum+term;
numer=-numer*x*x;
deno=deno*(2*i)*(2*i);
term=numer/deno;
}
printf("calculated value of cos(%f) is %f\n",angle,sum);
}
To embed this project on your website, copy the following code and paste it into your website's HTML: