Code:
/*To write a program for exponential function(e^x) upto nth term inputing the values of 'n' & 'x'*/
/*e^x=1+x+x^2/2!+...+x^n/n!*/
#include<iostream.h>
#include<conio.h>
float factorial(int n)
{
float f=1;
for(int i=1;i<=n;i++)
f=f*i;
return f;
}
float series(int n,int x)
{
float h=1;
for(int i=1;i<=n;i++)
h=h*x;
return h;
}
int main()
{
clrscr();
int n,x,i;
float s=1;
cout<<"Enter the value for 'n' & 'x': ";
cin>>n>>x;
for(i=1;i<=n;i++)
s=s+series(i,x)/factorial(i);
cout<<"The sum= "<<s;
getch();
return 0;
}
//this is my first post... please respond...

