Headlines
Loading...
C Program to find the exponential value

C Program to find the exponential value

C Program to find the exponential value

#include<stdio .h="">
#include<conio .h="">
#include<math .h="">
int fact(int no)
{
int i,f=1;
for(i=1;i&lt;=no;i++)
{
f=f*i;
}
return f;
}
void main()
{
int x,n,f,j;
float e=1,p;
clrscr();
printf("\nEnter the value of x: ");
scanf("%d",&amp;x);
printf("\nEnter the value of n: ");
scanf("%d",&amp;n);
for(j=1;j&lt;=n;j++)
{
p=pow(x,j);
f=fact(j);
e=e+p/f;
}
printf("\nExponential value is %0.2f",e);
getch();
}

**************OUTPUT**************

Enter the value of x: 2

Enter the value of n: 3

Exponential value is 6.33</math></conio></stdio>
*** PLEASE checkout the Best deals from for top sites like Amazon, Flipkart etc ***