The factorial of a number is the product of all positive integers less than or equal to that number. For example:
Write a console program that lets the user choose a number between 0 and 19. Calculate the factorial of that number. If the user chooses a number smaller than 0 or larger than 19, print an error message.
Your program should produce output exactly like this (user input in green):
Enter a number to calculate its factorial. Your number must be between 0 and 19:
4
Factorial of 4: 24
As you can see, you need to print the user-entered number and the calculated factorial as the last line of your program's output.
If the user enters a number that is not between 0 and 19, print an error message exactly like this:
Enter a number to calculate its factorial. Your number must be between 0 and 19:
-1
Your number (-1) is too small. It must be 0 or larger.
Another example:
Enter a number to calculate its factorial. Your number must be between 0 and 19:
20
Your number (20) is too large. It must be 19 or smaller.