You are on page 1of 1

#include<iostream>

#include<conio.h>
#include<math.h>
using namespace std;
#define PI 3.14159265
int fact(int n)
{
if(n==0)
return 1;
else
return n*fact(n-1);
}
double serie_cos(double x,int n)
{
double s=0;
for(int i=0;i<=n;i++)
s+=pow(-1,i)*(pow(x,2*i)/fact(i*2));
return s;
}
void main ()
{
double grad;
double result;
for(grad=0.0;grad<=360.0;grad++)
{
result = cos ( grad * PI / 180.0 );
cout<<"Cosinus de "<<grad<<" grade este : "<<result<<" comparativ cu "<<serie_
cos(grad * PI / 180.0, 10)<<"\n";
}
getch();
}