Write a program to calculate the factorial of a positive integerinput by the user. Recall that the factorial function is given byx! = x(x – 1)(x – 2)...(2)(1) so that 1! = 1, 2! = 2, 3! = 6, 4! = 24,5! = 120, ...(a) Write the factorial function using a Python while loop.(b) Write the factorial function using a Python for loop.Check your programs to make sure they work for 1, 2, 3, 5, and beyond, but especially for the first 5 integers.
Already registered? Login
Not Account? Sign up
Enter your email address to reset your password
Back to Login? Click here