Script
#!/usr/local/bin/python3.1
import time
n = int(input("Enter the number for which you need to calculate the factorial: "))
r = 1
while n > 0:
r = r * n
n = n - 1
print("Please give me a few seconds to calculate................")
print()
time.sleep(3)
print("The factorial of ", n, " is: ", r)
print()
#!/usr/local/bin/python3.1
import time
n = int(input("Enter the number for which you need to calculate the factorial: "))
r = 1
while n > 0:
r = r * n
n = n - 1
print("Please give me a few seconds to calculate................")
print()
time.sleep(3)
print("The factorial of ", n, " is: ", r)
print()
Execution
Enter the number for which you need to calculate the factorial: 10
Please give me a few seconds to calculate................
The factorial of 0 is: 3628800
Enter the number for which you need to calculate the factorial: 5
Please give me a few seconds to calculate................
The factorial of 0 is: 120
Enter the number for which you need to calculate the factorial: 25
Please give me a few seconds to calculate................
The factorial of 0 is: 15511210043330985984000000
No comments:
Post a Comment