diff --git a/factorial.py b/factorial.py index 17d78c5..6820c3e 100644 --- a/factorial.py +++ b/factorial.py @@ -8,3 +8,14 @@ def factorial(n): print factorial(-6) + +#another way of find factorial + +def f(n): + fact=1 + while n>1: + fact=fact*n + n=n-1 + print( fact) + +f(5)