# Program to check if number is Armstrong Number in Python

Here we will write a program to check where the number is Armstrong number in Python or not. Lets first understand what is an Armstrong number.

A positive integer is called an Armstrong number of order n if

`abcd... = an + bn + cn + dn + ...`

In case of an Armstrong number of 3 digits, the sum of cubes of each digits is equal to the number itself. For example:

```153 = 1*1*1 + 5*5*5 + 3*3*3  // 153 is an Armstrong number.
```

Now we will the the code for the same in Python.

## Python program to check if number is Armstrong Number

```# Python program to check if the number provided by the user is an Armstrong number or not

# take input from the user
# num = int(input("Enter a number: "))

# initialize sum
sum = 0

# find the sum of the cube of each digit
temp = num
while temp > 0:
digit = temp % 10
sum += digit ** 3
temp //= 10

# display the result
if num == sum:
print(num,"is an Armstrong number")
else:
print(num,"is not an Armstrong number")```

### OUTPUT:

```Enter a number: 407
407 is an Armstrong number```

Comment for any concerns.