Algorithm and Flowchart for Armstrong Number

[179794 views]



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
Remove WaterMark from Above Flowchart
Armstrong Number Implementation in Python: Python Program to Check Armstrong number

        



Facing Programming Errors. Get Answer within 48 hours:



Having Difficulty understanding above Algorithm and Flowchart? Buy my Personal Study Notes



Are You Good enough in Algorithms? Show Your Skills!



Giving is the Master Key to Success, in all applications of human life.


Comments

5 comment
  • Saikrisgna

    Thanks for giving valuable information

  • sam joshua

    You are doing great and website is not fancy like programiz

  • Rithwik

    Thank you for above algorithm It was really useful

  • James

    Thank you for the Notes. Was very useful.

  • aravindkumar

    bro thanking for your post



Search
For Sponsored Advertisement OR Freelance Programming Article Submission, Contact us at atechdailyweb@gmail.com
Recommended Deals Ends in







Quiz Challenge:
Online Games
Play 2048 Game Online and Relax.
Play 2048 Game Online

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