Ask a Question

Python # for num in range(100,10000):
temp=num
sum=0
while temp>0:
r=temp%10
sum=sum+r**3
temp=temp//10
if sum==num:
print (num)I have written the code but how to stop it after encountering first armstrong number?

for num in range(100,10000):
temp=num
sum=0
while temp>0:
r=temp%10
sum=sum+r**3
temp=temp//10
if sum==num:
print (num)I have written the code but how to stop it after encountering first armstrong number?

Fuel your ambition, discover your passion and achieve your professional goals with LetsUpgrade.

Sign Up Now