i m unable 2 get the output for the followin c program.(adsbygoogle = window.adsbygoogle || []).push({});

The factorial program is correct

i think there is problem in the FOR loop..guess its goin infinite...pls help

#include<stdio.h>

#include<math.h>

factorial(int);

main()

{

int n,count,i;

float number,x,series;

printf("nter number and no of terms");

scanf("%f %d",&number,&n);

x=3.14*number/180;

count=0;

series=0;

for(i=1;i<=(2*n);i+2)

{

series=series+pow(x,i)*pow(-1,count)/factorial(i);

count=count++;

}

printf("%f",series);

return 0;

}

int factorial(int m)

{int fact;

if(m==1)

return (1);

else

fact=m*factorial(m-1);

return(fact);

}

**Physics Forums - The Fusion of Science and Community**

Dismiss Notice

Join Physics Forums Today!

The friendliest, high quality science and math community on the planet! Everyone who loves science is here!

The friendliest, high quality science and math community on the planet! Everyone who loves science is here!

# Sine series

Loading...

Similar Threads - Sine series | Date |
---|---|

Algorithm to compute Basis images of an image | May 2, 2015 |

Pressure field decompose into Fourier series | Sep 14, 2012 |

High-frequency time series database | Sep 1, 2012 |

FORTRAN program for harmonic series sum | Jul 20, 2012 |

Linear interpolation of a sine wavetable | Jul 18, 2009 |

**Physics Forums - The Fusion of Science and Community**