Program to find whether the given number is armstrong or not
a=input("Enter any number : ") num=a sum=0 while a>0: re=a%10 sum+=re**3 a=a/10 if sum==num: print"The given number is an armstrong number" else: print"The given number is not an armstrong number"
OUTPUT :
Enter any number : 153 The given number is an armstrong number
Enter any number : 371 The given number is an armstrong number
Enter any number : 123 The given number is not an armstrong number
No comments