Header Ads

Responsive Ads Here

Question/Solution-4

Question



#  5  -  120 - example
# 5 * 4 * 3 * 2 * 1

#  user input - ??
output - factorial of user input



Answer




num = int(input("Enter the number: "))
output = 1

while num >= 1:
    output *= num
    num -= 1
print(output)

Powered by Blogger.