From c8850a36621794ac5b728f5c7445e73afb4582ea Mon Sep 17 00:00:00 2001 From: JatinR05 <71865805+JatinR05@users.noreply.github.com> Date: Thu, 1 Oct 2020 02:00:30 +0530 Subject: [PATCH 1/2] Update fact.py --- fact.py | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/fact.py b/fact.py index bcb83f3..54db943 100644 --- a/fact.py +++ b/fact.py @@ -1,9 +1,10 @@ a=input("Enter the number") - b=a-1 + if(a>0): - while(b>0): - a=a*b - b=b-1 + while(a>1): + a=a*(a-1) print"factorial",a + elif(a==0): + print "factorial 1" else: print"Enter positiive only" From 466c9beb28a7ff0004d0ae6df8fc26fe4f63047a Mon Sep 17 00:00:00 2001 From: JatinR05 <71865805+JatinR05@users.noreply.github.com> Date: Thu, 1 Oct 2020 02:01:01 +0530 Subject: [PATCH 2/2] Update fact.py --- fact.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/fact.py b/fact.py index 54db943..2d26d8b 100644 --- a/fact.py +++ b/fact.py @@ -7,4 +7,4 @@ elif(a==0): print "factorial 1" else: - print"Enter positiive only" + print"Enter positive number only"