#include <stdio.h>
#include <math.h>
int main() {
int num, a,r, n = 0;
double result = 0.0;
printf("Enter an integer: ");
scanf("%d", &num);
a = num;
while (a != 0) {
a /= 10;
++n;
}
a = num;
while (a!= 0) {
r = a % 10;
result += pow(r, n);
a /= 10;
}
if ((int)result == num) {
printf("%d is an Armstrong number.\n", num);
} else {
printf("%d is not an Armstrong number.\n", num);
}
return 0;
}
To embed this project on your website, copy the following code and paste it into your website's HTML: