series

What is the prblm with this code??
#include<iostream>
#include <cmath>
using namespace std;

int main(){
int i,n;
float fact,sum1,sum2,sum;
sum1=0;
sum2=0;
sum=0;
fact=1;
cin>>n;
for(i=0;i<=n;i++){
cout << "+" << n << "^"<< i <<"/" << i<< "!" ;

sum1=sum1+pow(n,i);
fact=fact*i;
sum2=sum2+fact;
sum=sum1/sum2;


}
cout<<endl << "s=" << sum ;
}
Last edited on
Topic archived. No new replies allowed.