def arm(n):
tot = 0
temp = n
while temp != 0:
r = temp % 10
tot = tot + r ** 3
temp = temp // 10
if tot == n:
return n
a = int(input("Enter the starting range: "))
b = int(input("Enter the ending range: "))
print ("\nArmstrong numbers between",a,"and",b,"is:")
for i in range(a,b):
if arm(i):
print(i)
tot = 0
temp = n
while temp != 0:
r = temp % 10
tot = tot + r ** 3
temp = temp // 10
if tot == n:
return n
a = int(input("Enter the starting range: "))
b = int(input("Enter the ending range: "))
print ("\nArmstrong numbers between",a,"and",b,"is:")
for i in range(a,b):
if arm(i):
print(i)
ScreenShots:
No comments:
Post a Comment