Table of Contents

Program to Find Armstrong Number

Example of Find Armstrong Number:
while True:
 print("Press 1 For Check Armstrong")
 print("Press 2 For Print Armstrong")
 print("Press 3 For Exit")
 a=input()
 if a=='1':
  n=int(input("Enter Number :"))
  l= len(str(n))
  b = 0
  m = n
  while m > 0:
   a = m % 10
   b =b+ a ** l
   m =m// 10
  if n == b:
   print(True)
  else:
   print(False)
 elif a=='2':
  x=int(input("min value :"))
  y=int(input("max value :"))
  for n in range(x, y + 1):
  l= len(str(n))
  b = 0
  m = n
  while m > 0:
   a = m % 10
   b =b+ a ** l
   m =m// 10
  if n == b:
   print(n)
 elif a=='3':
  break
 else:
  print("Wrong Input")
print("Thank You")