n= int (input ("enter the no. :"))
f=1. while n>0:
f=f*n.
n=n-1.
print ("factorial =",f)
output for the following python cording
Answers
Answered by
0
Answer:
It will print the factorial of the inputted number.
For example:-
If we input 5, the output will be 120
Explanation:
while loop will take the inputted value first and multiply it to f.
Then the loop control variable, i.e., n=n-1 makes n to take a value which is less than the original inputted value and this is multiplies again to f.
this cycle is continues until n reaches 1
Hope this helps
Similar questions