ajaybc
Youngling
I made this program for printing the sine series.It is not displaying any errors but just exiting without showing the result.Please help...
#include<iostream.h>
#include<conio.h>
#include<math.h>
double fact(double n)
{
if(n!=1)
return n*(n-1);
}
void main()
{
clrscr();
double f,x,s=-1,j,i,n;
cout<<"Enter the number:";
cin>>x;
cout<<"Upto how many terms:";
cin>>n;
j=1;
for(i=1;i<=n;i++)
{
s=s*(-1);
f=fact(j);
x=x+(s*(pow(x,j)/f));
j=j+2;
}
cout<<"Answer:"<<x;
getch();
}