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

Factorial of a non-negative integer n, denoted by n!, is the product of all posi

ID: 3632077 • Letter: F

Question

Factorial of a non-negative integer n, denoted by n!, is the product of all positivie integers less than or equal to n. For example,
5! = 5 x 4 x 3 x 2 x 1 = 120

Write a program that asks a user to enter an integer and display the factorial of that integer. The program should validate the input.
Ex:

Please enter a non-negative integer: 6
6! = 720

Please enter a non-negative integer: 0
0! = 1

Please enter a non-negative integer: -1
Factorial is not defined for a negative integer.

Please enter a non-negative integer: 10
10! = 3628800

Explanation / Answer

#include #include void main() { int i,n; long int p=1; coutn; if(n