Answer to Question #287343 in Python for Rox

Question #287343

For every program, there should be a softcopy file containing (i) Algorithm/Flowchart, (ii)

Source Code, (iii) Output


Q.Write a program to find factorial of a given number k.


1
Expert's answer
2022-01-14T04:36:44-0500
# Python 3 program to find 
# factorial of given number
 
# Function to find factorial of given number
def factorial(n):
      
    if n == 0:
        return 1
     
    return n * factorial(n-1)
  
# Driver Code
num = 5;
print("Factorial of", num, "is",
factorial(num))

Need a fast expert's response?

Submit order

and get a quick answer at the best price

for any assignment or question with DETAILED EXPLANATIONS!

Comments

No comments. Be the first!

Leave a comment

LATEST TUTORIALS
New on Blog
APPROVED BY CLIENTS