60 428
Assignments Done
98,1%
Successfully Done
In April 2018

Answer to Question #26663 in C++ for DIPESH

Question #26663
1+2!+3!+4!..............n!
Expert's answer
#include <iostream>
using namespace std;
// we're going to calculate factorial from number
int main(){
cout<<"Enter n\n";
// we ask people for N
int n ;cin>>n;
// 1*2*... n
long long num=1;
//for 1!+2!+3!+...+N!
long long sum = 0;
// we multiply 1 * 2 * 3 ... N
for (int i = 1 ; i <= n ; i++){
num *= i;
sum += num;
}
// out the answer
cout<<"the answer is: "<<sum<<endl;

return 0;
}

Need a fast expert's response?

Submit order

and get a quick answer at the best price

for any assignment or question with DETAILED EXPLANATIONS!

Comments

No comments. Be first!

Leave a comment

Ask Your question

Submit
Privacy policy Terms and Conditions