Write A Program To Print All Armstrong Numbers In A Given Range.
August 06, 2022 by Primegyan 9.89k
In This article we are share to Python Program to print all armostrong numbers in given range. first of all we should know What is armstrong number ? An Armstrong number is a number whose sum of cubes of digits is equal to the number itself. E.g. 370=33+73+03.
Program to print all Armstrong numbers in a given range in Python
s=int(input("Input start number : "))
e=int(input("Input end number : "))
for i in range(s,e+1):
num=i
temp = num
sum = 0
while num>0:
rem = num%10
sum = sum+(rem**3)
num = num//10
if temp == sum:
print(temp," ")
Output:
Input start number : 100
Input end number : 500
153
370
371
407
Print all armstrong numbers in a given range in Python - Video Solution