#include <stdio.h>
#include <math.h>
int main() {
int num=153, originalNum, remainder, result,n;
originalNum = num;
// Calculate the number of digits in the number
while (originalNum != 0) {
originalNum /= 10;
n++;
}
// originalNum = num;
// Calculate the sum of the digits raised to the power of n
while (originalNum != 0) {
remainder = originalNum % 10;
result
+= pow(remainder
, n
); originalNum /= 10;
}
// Check if the result equals the original number
if (result == num) {
printf("%d is an Armstrong number.\n", num
); } else {
printf("%d is not an Armstrong number.\n", num
); }
return 0;
}
I2luY2x1ZGUgPHN0ZGlvLmg+CiNpbmNsdWRlIDxtYXRoLmg+CgppbnQgbWFpbigpIHsKICAgIGludCBudW09MTUzLCBvcmlnaW5hbE51bSwgcmVtYWluZGVyLCByZXN1bHQsbjsKCiAKICAgIG9yaWdpbmFsTnVtID0gbnVtOwoKICAgIC8vIENhbGN1bGF0ZSB0aGUgbnVtYmVyIG9mIGRpZ2l0cyBpbiB0aGUgbnVtYmVyCiAgICB3aGlsZSAob3JpZ2luYWxOdW0gIT0gMCkgewogICAgICAgIG9yaWdpbmFsTnVtIC89IDEwOwogICAgICAgIG4rKzsKICAgIH0KCiAgICAvLyBvcmlnaW5hbE51bSA9IG51bTsKCiAgICAvLyBDYWxjdWxhdGUgdGhlIHN1bSBvZiB0aGUgZGlnaXRzIHJhaXNlZCB0byB0aGUgcG93ZXIgb2YgbgogICAgd2hpbGUgKG9yaWdpbmFsTnVtICE9IDApIHsKICAgICAgICByZW1haW5kZXIgPSBvcmlnaW5hbE51bSAlIDEwOwogICAgICAgIHJlc3VsdCArPSBwb3cocmVtYWluZGVyLCBuKTsKICAgICAgICBvcmlnaW5hbE51bSAvPSAxMDsKICAgIH0KCiAgICAvLyBDaGVjayBpZiB0aGUgcmVzdWx0IGVxdWFscyB0aGUgb3JpZ2luYWwgbnVtYmVyCiAgICBpZiAocmVzdWx0ID09IG51bSkgewogICAgICAgIHByaW50ZigiJWQgaXMgYW4gQXJtc3Ryb25nIG51bWJlci5cbiIsIG51bSk7CiAgICB9IGVsc2UgewogICAgICAgIHByaW50ZigiJWQgaXMgbm90IGFuIEFybXN0cm9uZyBudW1iZXIuXG4iLCBudW0pOwogICAgfQoKICAgIHJldHVybiAwOwp9Cg==