Documentation 10th (24-25)
Documentation 10th (24-25)
num=int(input("enter a number:"))
sum=0
temp=num
while temp>0:
digit=temp>10
sum+=digit**3
temp//=10
if num==sum:
print(num, " is an armstrong")
else:
print(num, "is not an armstrong")
11. Write a program to check the value of factorial
a=int(input("enter a number"))
factorial=1
if a<0:
print("sorry factorial does not exist for negative number")
elif a==0:
print("the factorial of 0 is 1")
else:
for i in range (1,a+1):
factorial=factorial*i
print("the factorial of ", a, "is", factorial)