0 like 0 dislike
in Examples, Exercises and Projects by (7k points)

A positive integer is called an Armstrong number of order n if

abcd... = an + bn + cn + dn + ...

In case of an Armstrong number of 3 digits, the sum of cubes of each digits is equal to the number itself. For example:

153 = 1*1*1 + 5*5*5 + 3*3*3  // 153 is an Armstrong number.

1 Answer

0 like 0 dislike
by (7k points)
 
Best answer

a=int(input())

a=str(a)

b=0

for i in range(len(a)):

    b=b+int(a[i])**len(a)

if b==int(a):

    print("Given number is Armstrongest number")

else:

    print("Given number is not Armstrongest number")

Register fast for winter training program at Goeduhub Technologies. We are providing winter training in AI-ML, IoT, Python, Hadoop and PLC-SCADA.

[[ CALL - 07976731765 ]]

...