Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

i need a help with this program in c++ which will calculate the factorial of an

ID: 3629606 • Letter: I

Question

i need a help with this program in c++ which will calculate the factorial of an integer value supplied by the user.

•You will use a for loop along with possibly other loop(s)
•You will declare your factorial result to be a long in order to accommodate large values


The factorial of a number n is defined as the product of all positive integers less than or equal to n and is represented as n!. For example, 5! is 5 x 4 x 3 x 2 x 1 = 120.

The factorial of 0 is defined to be 1.
the program prompt the user for a non-negative integer value and will display the factorial for the provided value.

examples of the display for the program:

$ ./factorial
Calculate the factorial of: 5
5! = 120
$

$ ./factorial
Calculate the factorial of: -4
Calculate the factorial of: -3
Calculate the factorial of: -19
Calculate the factorial of: -2
Calculate the factorial of: 7
7! = 5040
$

$ ./factorial
Calculate the factorial of: 0
0! = 1
$

$ ./factorial
Calculate the factorial of: 17
17! = 355687428096000
$


Explanation / Answer

#include using namespace std; int main() { int num; int sum=1; coutnum; while (num0) { for (int i=2; i