Find Armstrong Number in Given Range Using C Program - Source Code

Armstrong number in given range using c program

#include #include int main() { int sno, eno, number, originalNumber, rem, count = 0,result; printf("Programmed By Mohd Usman.\n"); printf("Find Armstrong numbers in given Range\n"); printf("-------------------------------------\n"); printf("Enter Starting Number : "); scanf("%d", &sno); printf("Enter Ending Number : "); scanf("%d", &eno); printf("Armstrong Numbers between %d and %d are : ", sno,eno); for (number = sno + 1; number < eno;number++) { originalNumber = number; while (originalNumber != 0) { originalNumber /= 10; ++count; } originalNumber = number; while (originalNumber != 0) { rem = originalNumber % 10; result += pow(rem, count); originalNumber /= 10; } if (result == number) { printf("%d ", number); } count = 0; result = 0; } }