123 Eng

Engineering the engineers™


Latest Jobs   Forum Map

 


Home
Source Codes
Engineering Colleges

Training  Reports
Seminar Reports
Placement Papers

Forums

   Computer Science / IT
   Electronics
   Electrical
   Mechanical
   Chemical
   Civil

   CAT / MBA

   GMAT / Foreign MBA
Latest Jobs

Engineering Jobs / Technical Jobs
Management Jobs

Sitemap
Terms of use

Displaying  Source Code(s)  
 

 
Taylor's series-e^x

--------------------------------------------------------------------------------

Description : C Program to print sum of e^x series.

#include <stdio.h>
#include <conio.h>
#include<math.h>
long int factorial(int n);
void main()
{
int x,i;
float s,r;
char c;
clrscr();
printf("You have this series:-1+x/1! + x^2/2! + x^3/3! + x^4/4!
..x^x/x!");
printf("
To which term you want its sum? ");
scanf("%d",&x);
s=0;
for (i=1;i<=x;i++)
{ s=s+((float)pow(x,i)/(float)factorial(i)); }
printf("The sum of %d terms is %f",x,1+s);
fflush(stdin);
getch();
}

long int factorial(int n)
{
if (n<=1)
return(1);
else
n=n*factorial(n-1);
return(n);
}

 

 

 

Contribute content or training reports / feedback / Comments
job placement papers
All rights reserved © copyright 123ENG