Question: Problem Specification: In mathematics, the notation n! represents the factorial of the nonnegative integer n. The factorial of n is the product of all the
Problem Specification: In mathematics, the notation n! represents the factorial of the nonnegative integer n. The factorial of n is the product of all the nonnegative integers from 1 to n. For example: 11 2131415161 75,040 Write a progran that lets the user enter a nonnegative integer and then uses a for-loop to calculate the factorial of that number. Print the factorial to standard output. SAMPLE RN #1 Enter a nennegative integers 7 7 factorial is 5040 Enter a nonnegative integeri 1 1 factorial is 1 SAMPLE #3 Enter a nonnegative integeri -10 -10 is not a nonnegative integer. Instructor Notes: You may assume that input values are integer values. However, if the user enters zero or a negative number, print an error message and exit the program as in the sameple run 3. Do NOT use the built-in math function factorial. Note: This problem should use a for-loop and an if statement. Ln: 21 Co F10 F11 F12
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
