18.WAP to accept any integer number and find its factorial.
CODE:
x=int(input("Enter any postive number\n"))
fact=1
for i in range(1,x+1):
fact=fact*i
print("Factorial of ",x, "is",fact)
OUTPUT:
Enter any postive number
3
Factorial of 3 is 6
CODE:
x=int(input("Enter any postive number\n"))
fact=1
for i in range(1,x+1):
fact=fact*i
print("Factorial of ",x, "is",fact)
OUTPUT:
Enter any postive number
3
Factorial of 3 is 6
Comments
Post a Comment