Tuesday, 6 November 2012

Factorial of Given Number Using While Loop?


n=input('Enter +ve Integer: ')
fact=1
i=1
while (i<=n):
    fact=fact*i
    i=i+1
print 'Factorial is: ',fact

No comments:

Post a Comment