n=int(input("enter value of n=")) no=int(input("no.of digits=")) x=n arm=0 while(n>0): r=n%10 arm=arm+(r**no) n=n/10 if(x==arm): print("given no. is armstrong number") else: print("given no. is not a 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