Write a python program to check whether a number is an Armstrong number or not.
For eg=1^3+3^3+5^3=153
Answers
Answered by
2
Answer:
num = int(input("Enter a number: "))
# initialize sum
sum = 0
# find the sum of the cube of each digit
temp = num
while temp > 0:
digit = temp % 10
sum += digit ** 3
temp //= 10
# display the result
if num == sum:
print(num,"is an Armstrong number")
else:
print(num,"is not an Armstrong number")
Answered by
0
Answer:
if num=sum...............
Similar questions