0

i thought out of the box and created a program to calculate factorial(which doesnt use recursion)

plz tell me why isnt this working https://code.sololearn.com/ch75cyRHMRvw/?ref=app

15th Mar 2020, 8:17 AM
PRO
PRO - avatar
2 odpowiedzi
+ 4
Put result = 1 Before the loop outside.
15th Mar 2020, 8:37 AM
Utkarsh Sharma
Utkarsh Sharma - avatar
+ 3
Remove result=1 from the loop f_no = int(input("give the no to take factorial of ")) multiples = list(range(2, f_no + 1)) result = 1 for i in range(f_no-1): result = result*multiples[i] print(result)
15th Mar 2020, 8:25 AM
Ore
Ore - avatar