Armstrong Number

Armstrong Number is a number whose sum of the power of digits is equal to the original number where power is number of digits in the number.

Example 1: 153. 13+53+33 = 1+125+27 = 153.

Example 2: 1634. 14+64+34+44 = 1+1296+81+256 = 1634.

C
#include <stdio.h>
#include <math.h>
void main()
{
    int n=0,r=0,s=0,nCopy=0,count=0;
    printf("Enter a number: ");
    scanf("%d",&n);
    nCopy=n;
    count=(int)log10(n)+1;
    while(n>0)
    {
        r=n%10;
        s=s+pow(r,count);
        n=n/10;
    }
    if(s==nCopy)
    {
        printf("%d is an Armstrong Number",nCopy);
    }
    else
    {
        printf("%d is not an Armstrong Number",nCopy);
    }
}
C