armstrong number

PHOTO EMBED

Wed Mar 13 2024 10:25:53 GMT+0000 (Coordinated Universal Time)

Saved by @pvignesh

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")
content_copyCOPY