my homework is to make a c program displayin de cosine series.....i made up one referrin buks but can it be made simpler or somethin using while statements..........

```
#include<iostream.h>
#include<conio.h>
#include<math.h>
int fact(int);//Global defenition
void main()
{
//cos(x)
//to find the power pow(number,power);
//to find root sqrt(number)-- in math.h
float cosx(float,int);
float x;
int n;
float final;
cout<<"\n Enter the limit ";
cin>>n;
cout<<"\n enter the value for x ";
cin>>x;
final=cosx(x,n);
cout<<"\n sum of cos series for "<<n<<" terms is "<<final;
getch();
}
float cosx(float x,int lm)
{
float term;
float sum=1;
for (int i=0;i<lm-1;i++)
{
//find factorial of c
int c=2;
term=pow(x,c)/fact(c);
term=term*-1;
sum=sum+term;
c=c+2;
}
return(sum);
}
int fact(int num)
{int res=1;
for (int j=1;j<=num;j++)
{ res=res*j;}
return(res);
}
```