C Programming Code Examples C > Mathematics Code Examples Program to Print Armstrong Number from 1 to 1000 Program to Print Armstrong Number from 1 to 1000 This C Program print armstrong number from 1 to 1000. An Armstrong number is an n-digit base b number such that the sum of its (base b) digits raised to the power n is the number itself. Hence 407 because 4^3 + 0^3 + 7^3 = 407 #include <stdio.h> main() { int number, temp, digit1, digit2, digit3; printf("Print all Armstrong numbers between 1 and 1000:\n"); number = 001; while (number <= 900) { digit1 = number - ((number / 10) * 10); digit2 = (number / 10) - ((number / 100) * 10); digit3 = (number / 100) - ((number / 1000) * 10); temp = (digit1 * digit1 * digit1) + (digit2 * digit2 * digit2) + (digit3 * digit3 * digit3); if (temp == number) { printf("\n Armstrong no is:%d", temp); } number++; } }