0

How to write python program to find the given number is an Armstrong number

21st Sep 2018, 6:09 AM
HARISH D UEE18127
HARISH D UEE18127 - avatar
2 Answers
+ 1
num = int(input("enter a number: ")) length = len(str(num)) sum = 0 temp = num while(temp != 0):     sum = sum + ((temp % 10) ** length)     temp = temp // 10  if sum == num:     print("armstrong number") else:     print("not ")
21st Sep 2018, 6:25 AM
estifanos
estifanos - avatar