This Program finds the Exponential using a simple C Program.
#include<stdio.h>
#include<conio.h>
#include<math.h>
double fact(double);
double po(double s)
{
double p=1.0,i,sum=1.0,val,f1;
for(i=1;i<=50;i++)
{
p=s*p;
f1=fact(i);
sum=(p/f1)+sum;
}
return(sum);
}
double fact(double n)
{
double ans=1.0,i;
if (n==0.0)
{
return(1);
}
for(i=1;i<=n;i++)
{
ans=ans*i;
}
return(ans);
}
void main()
{
double x;
clrscr();
printf("Enter the value of x \t");
scanf("%lf",&x);
printf("\nThe Value of power of e to x is %lf",po(x));
getch();
}
#include<stdio.h>
#include<conio.h>
#include<math.h>
double fact(double);
double po(double s)
{
double p=1.0,i,sum=1.0,val,f1;
for(i=1;i<=50;i++)
{
p=s*p;
f1=fact(i);
sum=(p/f1)+sum;
}
return(sum);
}
double fact(double n)
{
double ans=1.0,i;
if (n==0.0)
{
return(1);
}
for(i=1;i<=n;i++)
{
ans=ans*i;
}
return(ans);
}
void main()
{
double x;
clrscr();
printf("Enter the value of x \t");
scanf("%lf",&x);
printf("\nThe Value of power of e to x is %lf",po(x));
getch();
}