Created
July 15, 2018 13:29
-
-
Save solen003/63d1b011614329e748768c99be614be2 to your computer and use it in GitHub Desktop.
Write a program which can compute the factorial of a given numbers. The results should be printed in a comma-separated sequence on a single line.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#Write a program which can compute the factorial of a given numbers. | |
#The results should be printed in a comma-separated sequence on a single line. | |
def factorial(n): | |
value = 1 | |
for i in range(1, n+1): | |
value = value * i | |
return value | |
number = int(input("Type a number: ")) | |
print(factorial(number)) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment