Write a C Program to display Armstrong numbers between Limits (Range)

By | October 10, 2016

C Program to find Armstrong numbers 


Write a C Program to display Armstrong numbers between Limits (Range).This C Program displays all the armstrong numbers between the range entered by the user.

Armstrong number is a number which is equal to sum of digits raise to the power total number of digits in the number. Some Armstrong numbers are: 0, 1, 2, 3, 153, 370, 407, 1634, 8208 etc. We will consider base 10 numbers in our program.

Algorithm to display Armstrong number is: First we calculate number of digits in our program and then compute sum of individual digits raise to the power number of digits. If this sum equals input number then number is Armstrong and we display the output on the screen otherwise skip the number and proceed to next number.

Hence 153 because 1^3 + 5^3 + 3^3 = 1 + 125 + 27 = 153.

Here is source code of the C Program to display Armstrong numbers between Limits (Range). The C program is successfully compiled and run(Codeblocks) on a Windows system. The program output is also shown below.


SOURCE CODE : :



OUTPUT : :


 

Leave a Reply