Ads Top

Exponential series program using c

Exponential, series , program ,using c

Exponential series  program

#include<stdio.h>
#include<conio.h>
void main()
{
float x,t,sum;
int i,n,prod;
clrscr();
printf("Exponential series/n");
printf("Input x and n:/n");
scanf("%f%d",&x,&n);
t=1;
sum=1;
for(i=1;i<n;i++)
{
prod=i;
t=t*x/prod;
sum=sum+t;
}
printf("Raised to power x:%f \n",sum);
getch();
}

Output

Input x and n:2   3
Raised to power x:5.000000

No comments:

Touchfeeds. Powered by Blogger.