The following code shows how to Display All Armstrong Numbers in the Given Range in C.

//Find All Armstrong Numbers in the Given Range

#include <stdio.h>
#include <math.h>
int main()
{
    int mynum, temp, digitsum=0, rem, dv, t=0;
    int low, high, i, j;
    printf("Enter the lower value limit of the range: ");
    scanf("%d", &low);
    printf("Enter the higher limit of the range: ");
    scanf("%d", &high);

    for(mynum=low;mynum<=high;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 ", mynum);
        }
        digitsum=0;
        t=0;
    }
    return 0;
}

Output

Enter the lower value limit of the range: 1
Enter the higher limit of the range: 10000
1 2 3 4 5 6 7 8 9 153 370 371 407 1634 8208 9474


Further Reading

50+ C Programming Interview Questions and Answers

C Program to Find Factorial of a Number