/*PROGRAM TO PRINT SUM OF THE FOLLOWING SERIES -

X + X*X/2! + X*X*X/3! + X*X*X*X/4!....n terms.

I'm not getting the correct output.

eg-for n=3 and x=2;

compiler's ans = 4.66

correct ans = 5.3.

HELP ME OUT...*/

```
#include<iostream.h>
#include<math.h>
#include<conio.h>
void main ()
{
clrscr();
float x,sum=0;
int n,fact=1,j,k;
cout<<"\nEnter For n";
cin>>n;
cout<<"\nEnter For X";
cin>>x;
for(int i=1;i<=n;++i)
{
j=i;
k=i;
{
while(j)
{
fact=fact*j;
--j;
}
}
sum+=pow(x,k)/fact;
}
cout<<"The Sum Of Series Is:"<<sum;
getch();
}
```