Algorithm and Flowchart for Armstrong Number

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)

Pseudocode and Algorithm for Armstrong Number

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)] 5.2 num=num/10 Step 6: IF sum==temp Print "Armstrong Number" ELSE Print "Not Armstrong Number" Step 7: Stop

Pseudocode to find whether number is Armstrong Number or Not:

READ n temp=n sum=0 WHILE n>=0 sum=sum+(n%10)*(n%10)*(n%10) n=n/10 ENDWHILE IF sum==temp WRITE "NUMBER IS AN ARMSTRONG NUMBER" ELSE 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

Flowchart for Armstrong Number Armstrong Number Implementation in Python: Python Program to Check Armstrong number


Java Code Issues? Talk to Our Experts -> Message Now


1 comment
  • Saikrisgna

    Thanks for giving valuable information


Play 2048 Game Online

Today's Offer

Search Tags

    Pseudocode to find whether number is Armstrong Number or Not

    Armstrong Number Algorithm

    Pseudocode for Armstrong Number

    Algorithm for Armstrong Number

    How to find if a number is an Armstrong or Not