Write a program to find the factorial of 5 in python
Answers
Answered by
4
Answer:
See this example:
1.num = int(input("Enter a number: "))
2.factorial = 1.
3.if num < 0:
4.print("Sorry, factorial does not exist for negative numbers")
5.elif num == 0:
6.print("The factorial of 0 is 1")
7.else
8.for i in range(1,num + 1):
Explanation:
i hope my answer is Right
Answered by
0
for is the keyword in python which is used to form a loop whose definite length is known , it does not takes the last value . For example , the above loop will run till the number 'n' entered by the user and not till 'n+1' .
print is the keyword in python programming language . It print anything which is written within it .
input takes the input from the user in the form of string .
int converts the input into integer form .
Similar questions