# Python Program to find a Number is Armstrong or not

## Find a Number is Armstrong or not

In this program, we will be testing that whether the number entered by the user is a Armstrong Number or not. We will be writing all codes in Python for Armstrong Number. A Armstrong number is one which have the sum of its digits raised to their cube equal to itself
For Example:
Enter any number 1634.
14 + 64 + 34 + 44 = 153
Number is Armstrong ### Working:

Step 1. Start

Step 2. Import math class.

Step 3. Take a user input and store into int type value variable.

Step 4. First Convert int type value to string type and then convert string value into array format. and store into num variable.

Step 5. Initialize sum variable to 0.

Step 6. Run a for loop starts from 0 to length of the array.

Step 7. Inside for loop, using power method, and calculate the power of each element to its array size. Then add one by one with sum variable and stored into the sum variable as well.

Step 8. Outside the for loop, compare the values of sum and value, if both values are equal then print, “Given number is Armstrong number”.

Step 9. Else, print, “Given number is not Armstrong Number”.

Stop 10. Stop

### Python Program:

```import math
value = int(input("Enter the Number: "))
num = [int(d) for d in str(value)]
sum = 0
for i in range(0, len(num)):
sum = sum + math.pow(num[i], len(num))

if sum == value:
print("Given number is Armstrong Number")
else:
print("Given Number is not Armstrong Number")

# This code is contributed by Shubhanshu Arya (Prepinsta Placement Cell Student) ```

### Output:

Enter the Number: 156
Given Number is not Armstrong Number

Enter the Number: 153
Given number is Armstrong Number