#include <stdio.h>

int main() 
{
    int i,n;
    float x,sum=1,c=1;
    printf("Entet the value of x: \n");
    scanf("%f",&x);
    printf("Enter the value of n: \n");
    scanf("%d",&n);
    x=x*3.14/180;
    for (i=1;i<=n;i++)
        {
        c=c*(-1)*x*x/(2*i*(2*i-1));
        sum=sum+c;
        }
    printf("the value of cos(%.2f) is : %.4f",x,sum);
}

Embed on website

To embed this project on your website, copy the following code and paste it into your website's HTML: