isArmstrong function

bool isArmstrong(
  1. int number
)

Implementation

bool isArmstrong(int number) {
  int numDigits = numberOfDigits(number);
  int temp = number;
  int sum = 0;

  while (temp != 0) {
    int digit = temp % 10;
    sum += pow(digit, numDigits).toInt();
    temp ~/= 10;
  }

  return sum == number;
}