What is an Armstrong number?
An Integer number in which the sum of the cubes of its digits is equal to the number itself is called Armstrong Number. For example, 153 is an Armstrong number since 1**3 + 5**3 + 3**3 = 153.
(NOTE: 5**3 is nothing but 5*5*5)
Algorithm to find whether number is Armstrong Number or Not
Step 1: Start
Step 2: Declare Variable sum, temp, num
Step 3: Read num from User
Step 4: Initialize Variable sum=0 and temp=num
Step 5: Repeat Until num>=0
5.1 sum=sum + cube of last digit i.e [(num%10)*(num%10)*(num%10)]
Step 6: IF sum==temp
Print "Armstrong Number"
Print "Not Armstrong Number"
Step 7: Stop
Pseudocode to find whether number is Armstrong Number or Not:
WRITE "NUMBER IS AN ARMSTRONG NUMBER"
WRITE "NUMBER IS NOT AN ARMSTRONG NUMBER"
We first take input from user and store it in variable n. Then we initialize 2 variables temp to n and sum to 0. We calculate the cube of last digit by this expression [(n%10)*(n%10)*(n%10)] and add it to value of sum and also divide n by 10. We repeat the above step until n is greater than or equal to 0. At last, we check whether sum is equal to temp, if yes Print "Number is Armstrong Number" else print "Number is Not Armstrong Number".
Flowchart For Armstrong Number
Armstrong Number Implementation in Python: Python Program to Check Armstrong number