Now here is a code with C++ syntax.
hope this will help you and you will rate me..
#include<iostream.h>
#include<conio.h>
#include<math.h>
void main()
{
int n;
float x,s=0;
cout<<"You have this series:-1+x/1! + x^2/2! + x^3/3! + x^4/4!..x^x/x!";
cout<<"\n"; \\\\for line change
cout<<"To which term you want its sum?"
cin>>n;
s=0;
for(i =1;i<=n;i++ )
{
s=s+((float)pow(x,i)/(float)factorial(i)); ////float is a data type
}
cout<<"The sum of " <<n<<" terms is :" <<1+s;
getch();
}
long int factorial(int n) /////factorial function
{
if (n<=1)
return(1);
else
n=n*factorial(n-1);
return(n);
}