I have a program to find the Sin value of a given value(in radian) . It is working properly , but i want a better program or can u please give me a small explanation about my code . please ...
in my program
n=2; // what is this meaning
#include<iostream.h>
#include<math.h>
#include<conio.h>
void main()
{
float x,s=0,term,f;
int n,k;
cout<<"Enter the value:";
cin>>x;
k=x;
x=(x*22)/(7*180);
term = x;
cout<<x<<"\n";
cout<<sin(x)<<"\n";
fabs(s-(sin(x)));
n=2;
while(fabs(s-sin(x))>0.0001 )
{
s=s+term;
f=-(x*x)/(n*(n+1));
term = term*f;
n=n+2;
}
cout<<"Sin "<<k<<"="<<s;
getch();
}
Please......