Write a Python Program to print factorial of a number using for loop.
Answers
Answered by
5
Answer:
num = int(input("enter a number: "))
fac = 1
for i in range(1, num + 1):
fac = fac * i
print("factorial of ", num, " is ", fac)
Explanation:
Please mark me as Brainliest !!
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
English,
25 days ago
Math,
25 days ago
Environmental Sciences,
1 month ago
Geography,
1 month ago
English,
9 months ago
Business Studies,
9 months ago
English,
9 months ago