WABP to store a no and find it is Armstrong no or not in G W basic
Answers
Answered by
1
Answer:
Explanation:
An Armstrong number is an n-digit base b number, such that the sum of its digits raised to the power n is the number itself. Hence, 153 because 13 + 53 + 33 = 1 + 125 + 27 = 153. Using while loop checks the value of 'number' variable is not equal to 0. If the condition is true, execute the iteration of the loop.
Count digits approach:
in this approach, we're using a helper array of size 10 (initial value of each element = 0)
we then iterate on both the numbers; while doing so, increment the array digit by 1 for first number and decrement by 1 for second number.
Similar questions