Armstrong

Armstrong number python program

Hey internet mates here we are going to make a python program to search for the armstrong numbers from a given list of three digit numbers.

What are armstrong numbers?

The numbers which get itself on adding each of it’s digit when digit is raised to the number of digits in that number.

li=[]
print("Enter Numbers:")
for x in range(10):
    a=int(input(":-"))
    li.append(a)
armstrong=[]
for y in li:
    q=y
    s=0
    while y>0:
        w=y%10
        d=(w**3)
        s=s+d
        y=y//10
    if s==q:
        armstrong.append(q)
print("ARMSTRONG NUMBERS ARE:-",armstrong)

Output.

3 thoughts on “Armstrong”

Leave a Comment

Your email address will not be published. Required fields are marked *