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