+ 1
To find factorial
program to find factorial of a number
4 ответов
+ 14
def factorial(num):
if num == 1:
return 1
else:
return num * factorial(num-1)
print(factorial(5))
+ 5
@Dayve, you were too fast to answer
...print(factorial(int(input())))
+ 3
#if you tag string so....
def fact(num):
num=int(num)
if not num:
return 1
else:
return num*fact(abs(num-1))
print(fact(5))
print(fact(-5))
print(fact("-5"))
print(fact(0))
print(fact(input()))
#Currently study on factorial of float number :(