By difinittion, n! is the product of all positive integers less than or equal to n, where
Fantastic news! We've Found the answer you've been seeking!
Question:
By difinittion, n! is the product of all positive integers less than or equal to n, where n is non-negative integer. For example, 5!=5*4*3*2*1 = 120. Now write a function int factorial(int n) as below, and write a program to prompt a user to type a non-negative intege. Your program should call function factorial() to calculate all factorials of integers which are less than or equal to user's input integer.
Figure 2: A sample output of the program
$ Please type a non-negative integer:
$5
$ The factorial sequences less than or equal to 5 is: n n!
01
11
22
36
4 24
5 120
Related Book For
Posted Date: