78 442
Assignments Done
Successfully Done
In September 2019

Answer to Question #24588 in C++ for Calvin Thames

Question #24588
Write a program that asks user to input a number N. The program will check if N is between 1 and 10. If the number is not in the proper interval, output “Incorrect interval”. Then the program will calculate and output the sum of factorials: 1+2!+3!+...+N!
Expert's answer
#include <iostream>

#include <conio.h>
using namespace std;

double factorial(long n){
if (n < 1)
return 0;
double product = 1;
for (int i = 1; i <= n; i++)
product *= i;
return product;
int main()
int number=0;
cout<<"Enter number: ";
if(number>=1 && number<=10){
cout<<"Factorial = "<<factorial(number);
} else{
cout<<"Incorrect interval
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!


No comments. Be first!

Leave a comment

Ask Your question

Privacy policy Terms and Conditions