Python Programming: Checking of Armstrong Number
#Program to check whether a number is Armstrong or Not
n=int(input("Enter a number"))
s=0
n1=n
while(n>0):
r=n%10
s=s+(r**3)
n=n/10
if(s==n1):
print(n1," is Armstrong Number")
else:
print(n1," is not Armstrong Number")
n=int(input("Enter a number"))
s=0
n1=n
while(n>0):
r=n%10
s=s+(r**3)
n=n/10
if(s==n1):
print(n1," is Armstrong Number")
else:
print(n1," is not Armstrong Number")
Comments
Post a Comment