Question: in c++ Write a program named factorial.cpp that asks the user for an input integer n. Make sure integer n is less than or equal
Write a program named factorial.cpp that asks the user for an input integer n. Make sure integer n is less than or equal to 12 and greater than or equal to 0. Otherwise, give an appropriate error message and ask the user for another number until they comply. Finally, calculate the factorial of n and exit the program. This program must use loops to calculate the results (do not use math functions defined in any C++ libraries) Sample Output Enter a number to calculate its factorial: -4. Can't calculate the factorial of a negative number. Enter a number to calculate its factorial: 153 Factorial too big. Enter a number to calculate its factorial: 8. 40320 8 ! Enter a number to calculate its factorial: -1. Can't calculate the factorial of a negative number. Enter a number to calculate its factorial: 0.1 0! - 1
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
