Skip to main content

Armstrong Number

           An Armstrong number is an n-digit number that is equal to the sum of the nth powers of its digits.
For example 153 is an Armstrong Number in 3 digit number
13 + 53 + 33  = 153

1  +125+27  =153

1634 is an Armstrong Number in 4 digit number
14 + 64 + 34 + 44 = 1634

1+1296+81+256=1634

And so numbers from 0-9 all are Armstrong Numbers as  01 is 0 , 11 is 1, 21 is 2 , 31 is 3 and so on.. 


Armstrong Algorithm

Step1: Read a number. 

Step2:  Store all the digits of a number in an array digits[]

Step3:  Count all the digits of a number and store in variable   length

Step4:  Start a loop till  the length of a number

Step5: Raise each digit to a power equal to the number of digits in the number. For ex, each digit of a three‑digit number would be raised to the third power; each digit of a Seven‑digit number would be raised to the Seventh power; and so on

Step6: Add the results to variable  sum

Step7: Now check if number is equal to sum.

Step8:If the condition is true then display “It is an Armstrong Number’’ Else display “It is not an Armstrong Number”.

Step9: Stop 

                       ARMSTRONG Flowchart






To write the program in C
Click here to watch on YouTube






To Understand the working of Flowchart 




To make the Armstrong Number App in MIT App Inventor
Click here to watch on YouTube

Comments

Popular posts from this blog

Fibonacci Sequence Flowchart

Fibonacci Sequence Flowchart In the previous video of Fibonacci sequence ,we learned about the Fibonacci series and how to write an algorithm. In this video we will learn how to draw a flowchart for it. First let us write an algorithm for it again. 0,1,1,2,3,5,8,13,21,34,55,89,… Step1: Input the number(n) till which the Fibonacci series will run Step2: Assign the variables a equal to -1 and b equal to 1 Step3: Add the variables a & b and assign it to variable x Step4: Display the value of x Step5: Assign the value of b to variable a Step6: Assign the value of x to variable b Step7: Subtract one from n and store it to variable n Step8: If the value of n is not zero, go back to the Step3 Step9: Fibonacci numbers displayed till n numbers. To see the working of above flowchart,  Click here to Watch on YouTube To write the program in C,   Click here to Watch on YouTube To make the Fibonacci Sequence  And...

Decimal Number to Binary Number

A Binary Number consists of  0 s & 1 s only (Two Digits)   whereas a  Decimal Number Consists of 0,1,2,3,4,5,6,7,8,9 (ten digits) .                   For Example ( 111 )2 is binary number equivalent to decimal number ( 7 )10.  A bit is a single Binary Digit. The binary number above has three bits. Algorithm Divide the dividend(number) by divisor 2 and get the remainder & the quotient. If the quotient is not zero, then quotient becomes dividend and follow above step. As quotient has now become zero, the binary number is all the remainders from bottom or from right side which consists of 0 & 1. Flowchart To see the working of above Flowchart Click here to watch it on YouTube