n=int(input('enter number:'))
a=n
b=len(str(n))
sum1=0
while n!=0:
c=n%10
sum1=sum1+(c**b)
n=n//10
if(a==sum1):
print('armstrong')
else:
print('not armstrong')
Preview:
downloadDownload PNG
downloadDownload JPEG
downloadDownload SVG
Tip: You can change the style, width & colours of the snippet with the inspect tool before clicking Download!
Click to optimize width for Twitter