Learner Level
Implement the isArmstrongNumber method that checks whether a number is equal to the sum of its digits raised to the digit count.
The input contains an integer n. Your task is to check whether n is an Armstrong number.
An Armstrong number is equal to the sum of its digits raised to the power of the number of digits. For example, 153 has three digits, and 1^3 + 5^3 + 3^3 = 153, so it is an Armstrong number.
First count how many digits are present in the number.
Then process each digit, raise it to the power of the digit count, and add it to a running sum. At the end, compare the sum with the original number. If both are equal, return true; otherwise return false.
Pseudocode:
function isArmstrongNumber(n):
original = n
digits = count digits in n
sum = 0
while n > 0:
digit = n % 10
sum = sum + power(digit, digits)
n = n / 10
return sum == original