maynul67

3 digit Armstrong Number Checker

Jul 17th, 2021
553
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. num = int(input("Enter an integer of 3 digit : "))
  2.  
  3. sum = 0
  4. num1 = num
  5. while num1 > 0:
  6.     a = num1 %10
  7.     sum = sum + a**3
  8.     num1 = num1 // 10
  9.  
  10. if sum == num:
  11.     print(num, " is an armstrong number")
  12. else:
  13.     print(num, "is not an Armstrong number")
  14.  
RAW Paste Data