Hi there,
It is my mid-term exam and I need it today, does anybody knows, why my program get stack?
Here is the code:
Thanks in advance....#include <stdio.h>
#include <math.h>
main(void)
{
double x, n, sine, terms;
int i;
double pi = 3.14159265;
printf("Please enter the value of (x) in radians: ");
scanf("%f", &x);
x = x*pi/180.0;
sine = x;
terms = x;
for (i=1; terms<0.00001; i++)
{
terms = (-1)*terms*x*x/(2*i*(2*i+1));
sine = sine + terms;
}
printf("\n\n\n");
printf("The value of the sine is %f to %d terms.\n\n",sine,i);
getch ();
}