Armstrong number program in python using while loop. Armstrong may or may not use Python as a programming language. This program is used to determine whether or not a number is an Armstrong number. There are some basic programs that have been defined, and this program is one of them. An Armstrong number is any number with n digits that is equal to the sum of the number’s nth power of digits.
a = int(input("Enter the number ")) sum = 0 temp = a while temp > 0: digit = temp % 10 sum += digit ** 3 temp //= 10 if a == sum: print(a,"is an Armstrong ") else: print(a,"is not an Armstrong")
Enter the number 45
45 is not an Armstrong