Subscribe to Feeds

Send Your Projects To georgepj@hotmail.com

We'll Publish It With Your Name :-)

Programs Can Also Be Downloaded From The Folders Below....[Or Scroll Down]

Sine, Cosine & Exponential Series

Click Here To Download C File Of This Program

 //SIN COSIN AND EXPONENTIAL SERIES  
//Downloaded from www.c4cprog.co.nr
#include<conio.h>
void main()
{
int n,op,p,i,k,j,x;
float e,sum=0.0,temp=0.0,r;
clrscr();
printf("Enter Value of x :");
scanf("%d",&x);
r=(3.14*x)/180.0;
printf("\nEnter Value of n :");
scanf("%d",&n);
printf("\n\n\n\tEnter Choice :\t\n\n1.Sine Series\t\n2.Cosine Series\t\n3.Exponential Series\n\n");
scanf("%d",&op);
switch(op)
{
case 1:
sum=r;
temp=r;
for(i=3;i<=(2*n)-1;i=i+2)
{
temp=temp*-1.0*((r*r)/(i*(i-1.0)));
sum=sum+temp;
}
printf("\n\nSum = %f",sum);
break;
case 2:
sum=1.0;
temp=1.0;
for(i=2;i<=(2*n)-1;i=i+2)
{
temp=temp*-1.0*((r*r)/(i*(i-1.0)));
sum=sum+temp;
}
printf("\n\nSum = %f",sum);
break;
case 3:
temp=1.0;
sum=1.0;
e=1.0;
for(i=1;i<n;i++)
{
temp=temp*(x/e);
sum=sum+temp;
e++;
}
printf("\n\nSum = %f",sum);
break;
default :
printf("\n\n\t\t\t Invald Choice");
}
getch();
}
/*
Enter Value of x :5
Enter Value of n :2
Enter Choice :
1.Sine Series
2.Cosine Series
3.Exponential Series
1
Sum = 0.087112
2
Sum = 0.99616
3
Sum = 6.00000
*/

1 comments:

Akhilkumar said...

thanx buddy................ :)

Post a Comment