###### tags: `I2P(I)Hu2022`
# 13589 - Little Kai's Treat
> by schdoel
## Brief
Figure out if a number is a special number or not.
Special number is an base-3 armstrong number.
> An Armstrong number is a number that is the sum of its own digits each raised to the power of the number of digits. (In this case, powered to 3).
## Solution
Cube each digit and sum it all together.
**Do not use pow from math.h, because pow will return double. There may be floating point errors when used directly in this way. You can use for loop instead to calculate the powers. ^^**
## Reference Code
```cpp=
#include <math.h>
#include <stdio.h>
int main() {
int num;
while(scanf("%d", &num)!=EOF){
int check, r, result = 0, n = 0;
check = num;
while (check != 0) {
r = check % 10;
result += (r*r*r);
check /= 10;
}
if (result == num) printf("Yes it is.\n");
else printf("No it is not.\n");
}
return 0;
}
```