The following code shows how to Find Whether a Number is an Armstrong Number or Not in C.

//Find Whether a Number is an Armstrong Number or Not

#include <stdio.h>
#include <math.h>
int main()
{
    int mynum, temp, digitsum=0, rem, dv, t=0;
    printf("Enter a number: ");
    scanf("%d", &mynum);
    temp=mynum;
    while(temp!=0)
    {
        temp=temp/10;
        t++;
    }
    temp=mynum;
    while(temp!=0)
    {
        rem=temp%10;
        digitsum+=pow(rem, t);
        temp=temp/10;
    }
    if(digitsum==mynum)
    {
        printf("%d is an Armstrong number!", mynum);
    }
    else
    {
        printf("%d is not an Armstrong number!", mynum);        
    }
    return 0;
}

Output

Enter a number: 1634
1634 is an Armstrong number!


Further Reading

50+ C Programming Interview Questions and Answers

C Program to Find Factorial of a Number