Question: NEEDS TO BE A BEGINNER CODE. FOR AN INTRO LEVEL. CODE NEEDS TO BE IN C++ Lab #4b-Factorial Let n be a non-negative integer. The
NEEDS TO BE A BEGINNER CODE. FOR AN INTRO LEVEL. CODE NEEDS TO BE IN C++
Lab #4b-Factorial Let n be a non-negative integer. The factorial of n, written n!, is defined by: 0! = 1 n! = 1*2*3*..... * n, if n > 1 For example, 4! = 1 * 2*3 * 4 = 24. Write a program that prompts the user to enter a non-negative integer and outputs the factorial of the number. Your output should resemble the following: What is your value of n: 4 4! = 24 What is your value of n: 0 O! = 1 What is your value of n: -8 Sorry, you cannot determine the factorial of a negative number. Note that you should be printing 3 samples of output along with your code "for the value of n": a non-negative integer value zero a negative integer value
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
