#I took indentation 3
#taking input number from user
number = int(input("Enter a number:: "))
#Now I need to know no. of digits in number
n = number
count = 0
while(n != 0):
n = n//10
count += 1
#This print statement just to understand no.of digits in the number
print("No. of digits in your number are ", count)
#Count is now storing no. of digits
n = number
result = 0
while n != 0 :
remainder = n%10
result = result + remainder ** count
n = n//10
if number == result :
print(number," is an Armstrong number")
else :
print(number," is not an Armstrong number")
0 Comments