n=int(input('enter number:')) temp=n length=len(str(n)) summ=0 while(n!=0): rem=n%10 summ=summ+rem**length # pow(rem,length) n=n//10 if summ==temp: print('It is Armstrong Number') else: print('It is not Armstrong Number')
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