Armstrong number

arms=0

for i in range(100,1000):

    n=i

    while n>0:

        rem=n%10

        arm=rem**3

        arms=arms+arm

        n=n//10

    if(arms==i):

        print(i,'is an armstrong number.')

    arms=0    

Comments

  1. An armstrong number is number whose sum of the cube of it's digits is the number itself

    ReplyDelete

Post a Comment