/* Cosine series   : 1 - x2/2! + x4/4! - x6/6! + x8/8! ...... */
#include<stdio.h>
#include<conio.h>
#include<math.h>
void main()


    {
	int n,i;
	float x,degree,temp,sum=1;
	clrscr();
	printf("Enter value for x:");
	scanf("%f",&x);
	printf("Enter number of terms:");
	scanf("%d",&n);
	degree=x;
	x=x*(3.1415/180);
	temp=1;

	for(i=1;i<=n;i++)
	{
		temp=temp* pow ((double)(-1),(double)(2*i-1))*x*x/((2*i)*(2*i-1));
		sum=sum+temp;
	}
	printf("\nSum of Cos(%f)=%.5f",degree,sum);
	getch();
    }