Question: Write a program that computes and prints out the first m factorials of ODD numbers (where the value for m is from user input), in
Write a program that computes and prints out the first m factorials of ODD numbers (where the value for "m" is from user input), in reverse order.
For example, if m = 4, calling AllOddFactorials(m) will print 7!, print 5!, print 3! and then print 1! (do not print any factorial of even numbers). The literal outputs should be (for m = 4), Note the prints must be in reverse order. (Like the example below.)
5040
120
6
1
The code below I created to compute factorials. What should I add to make this code print the factorials of odd numbers in reverse order (shown in the example above):
def Factorial (n): if n == 0: return 1 else: return n * Factorial (n-1) n = int(input("Enter a number to compute the factorial : ")) result = Factorial(n) print(result)
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
