Armstrong number is also known as narcissistic number. A number is equal to the sum of the cubes of its own digits.
372 is an Armstrong number since
372 = 333+777+111.
n= int(input("Enter a number")) sum = 0 temp = n while temp>0: digit = temp%10 sum+=digit*3 temp//=10 if n == sum: print(n, "is an Armstrong number") else: print(n, "is not a Armstrong number"))