Python Online Compiler
Example: Python program to check the input integer number is an Armstrong number using the while loop
C
C++
C#
Java
Python
PHP
main.py
STDIN
Run
# Python program to check the input integer number is an Armstrong number using the while loop print("Enter the positive integer number:", end=" ") x, r, i = str (input ()), 0, 0 while i < len (x): r += int (x[i]) ** len (x) i += 1 # if x is equal to r, the number is an Armstrong number if int (r) == int (x): print(x, " is an Armstrong number.") else: print(x, " is not an Armstrong number!")
370
Output
Clear
ADVERTISEMENTS