|
|
#include<iostream.h> #include<conio.h> #include<math.h> void main() { int n,x,ans,fact=0,pro; clrscr(); cout<<"Enter the number till which you want to calculate the cos value"; cin>>n; cout<<"Enter the value of x"; cin>>x; for(int j=1;j<=n;j++) { fact=fact*j; pro=fact; } for(int i=2;i<=n;i+=2) { ans=1-(pow(x,i)/pro); } cout<<cos(ans); getch(); }
|