# Program to find all Armstrong numbers between 0 and 999

An Armstrong number of three digit is a number such that that sum of the cubes of it's digits is equal to the number itself For example 153 is an Armstrong number because cube of 1 is 1(1x1x1=1) + cube of 5 is 125(5*5*5=125) + cube of 3 is 27(3*3*3=27). Now add all the cubes 1+125+27=153 which is equals to number itself

 1 `#include ` 2 `#include ` 3 `#include ` 4 `#include ` 5 6 `int noOfDigits(int n){` 7 ` unsigned int number_of_digits = 0;` 8 ` ` 9 ` do {` 10 ` ++number_of_digits; ` 11 ` n /= 10;` 12 ` } while (n);` 13 ` ` 14 ` return number_of_digits;` 15 `}` 16 17 18 `int main()` 19 `{` 20 ` int num,rem,qub,sum=0,i,len;` 21 ` printf("Armstrong numbers between 0 to 999 are: ");` 22 23 ` for(i=0; i<=999; i++)` 24 ` {` 25 ` num=i;` 26 ` sum=0;` 27 ` len=noOfDigits(i);` 28 ` while(num>0)` 29 ` {` 30 ` rem=num%10;` 31 ` qub=pow(rem,len);` 32 ` sum=sum+qub;` 33 ` num=num/10;` 34 ` }` 35 ` if(sum==i)` 36 ` {` 37 ` printf("%d,",sum);` 38 ` }` 39 ` }` 40 ` getch();` 41 `}` 42 43 `http://www.sachinpuri.com/Article/61/what_is_an_armstrong_number.html`

by jinyizhixia on 19-Mar-2018 06:16 am

# light up shoes

•  0 Like
•  0 Dislike
• Report
by jinyizhixia on 19-Mar-2018 06:15 am

# light up shoes

•  0 Like
•  0 Dislike
• Report
by jinyizhixia on 19-Mar-2018 06:15 am

# light up shoes

•  0 Like
•  0 Dislike
• Report
by xiaojun on 16-Mar-2018 02:15 pm
20180316 junda

# lacoste polo shirts

•  0 Like
•  0 Dislike
• Report
by 11 on 06-Mar-2018 08:43 am

# pandora bracelet

xdj7410258@yahoo.com

# fitflops sale clearance

XDJ7410258@yahoo.com
•  0 Like
•  0 Dislike
• Report
by 11 on 06-Mar-2018 08:43 am

# pandora bracelet

xdj7410258@yahoo.com

# fitflops sale clearance

XDJ7410258@yahoo.com
•  0 Like
•  0 Dislike
• Report
by asd on 27-Feb-2018 12:49 pm
hll20180227

# hll20180227

•  0 Like
•  0 Dislike
• Report
by xxx on 20-Jan-2018 08:22 am

# retro jordans

•  0 Like
•  0 Dislike
• Report
by chenlina on 27-Dec-2017 06:15 am
chenlina20171227

# north face

chenlina20171227
•  0 Like
•  0 Dislike
• Report
by fathima on 20-Sep-2015 09:00 pm
How to write this in java?
•  1 Like
•  4 Dislike
• Report
by Phponwebsites on 28-Aug-2015 06:10 pm
Thank you very much..
•  0 Like
•  0 Dislike
• Report
by jisha varghese on 21-Mar-2015 08:47 am
thanks for this program
•  0 Like
•  0 Dislike
• Report
by karthik on 07-Feb-2015 01:35 pm
mr.author infact 1,2,3,4,5,6,7,8,9 is also an armstrong number but your program doesnt display those so plz do the necessary
•  1 Like
•  0 Dislike
• Report
by aakash on 28-Dec-2014 04:34 pm
Thks for this program
•  0 Like
•  0 Dislike
• Report
by sagar on 17-Dec-2014 04:12 pm
what is rem and qub.
•  0 Like
•  0 Dislike
• Report
by elakkiya.m on 28-Sep-2014 02:23 pm
nice idea,good luck for creating new ideas
•  0 Like
•  0 Dislike
• Report
by NamevishnĂș on 26-Sep-2014 09:00 pm
Type your comment...I. not. I. programing friendzzzz. so. pllzz. tell. programing and problem solving apidi. padikarathunuu. programing gaaa. varamatikuthuuu
•  0 Like
•  0 Dislike
• Report
by ammu on 19-Nov-2013 03:56 pm
•  0 Like
•  3 Dislike
• Report
by nakshatra on 19-Nov-2013 03:55 pm
thank uuuuuuuuuuu
•  0 Like
•  0 Dislike
• Report
by IGNOU Student on 14-Sep-2013 11:11 pm
Thanks for the help, These algorithms are very useful for IGNOU MCA students
•  13 Like
•  0 Dislike
• Report
by ragul on 04-Jul-2013 03:58 pm
thank you
•  8 Like
•  0 Dislike
• Report
by ragul on 04-Jul-2013 03:57 pm
thank u
•  5 Like
•  0 Dislike
• Report
by garima moradia on 22-Apr-2013 12:31 pm
thank u .... :)
•  2 Like
•  1 Dislike
• Report
by Sanjana Desai on 13-Mar-2013 09:21 pm
its easy:)
•  5 Like
•  1 Dislike
• Report
by umar mustapha on 26-Sep-2012 11:59 am
Write a C program that will accept 5 integers and display the lowest integer
•  0 Like
•  1 Dislike
• Report
by Sachin Puri on 26-Sep-2012 11:41 pm
http://www.sachinpuri.com/forum_posts.php?fid=271
•  0 Like
•  0 Dislike
• Report
by umar mustapha on 26-Sep-2012 11:58 am
Type your comment...Write a C program that will accept 5 integers and display the lowest integer
•  0 Like
•  0 Dislike
• Report
by java67 on 31-Aug-2012 08:03 am
Here is my way of finding Armstrong number in java
•  0 Like
•  0 Dislike
• Report
by Santhosh on 07-Jun-2012 07:43 am
2 is an Armstrong number and how this program works for 2 through 9??2=2^3??
•  5 Like
•  2 Dislike
• Report
by Sachin Puri on 07-Jun-2012 10:52 pm
This program is only for 3 digit armstrong numbers. Please see this updated one for all the numbers. http://www.sachinpuri.com/Algorithm/15/program_to_find_all_armstrong_numbers_(php).html
•  16 Like
•  1 Dislike
• Report
by anukul on 25-May-2012 11:02 pm
•  2 Like
•  2 Dislike
• Report
by Sachin Puri on 27-May-2012 12:15 am
Thanks bro
•  1 Like
•  1 Dislike
• Report
by kamlesh on 03-Apr-2012 07:51 am
this is my prog
•  1 Like
•  3 Dislike
• Report
by Sachin Puri on 03-Apr-2012 12:27 pm
What do you mean by saying this?
•  1 Like
•  1 Dislike
• Report
by jesna on 22-Mar-2012 10:28 am
This one is the right program. Thanks for sharing Sachin!
•  2 Like
•  2 Dislike
• Report
by Sachin agnihotri on 03-Jan-2012 09:21 pm
Tell me the program to find all armstrong number whether it is 4 digit or 5 digit
•  2 Like
•  1 Dislike
• Report
by Sachin Puri on 04-Jan-2012 02:07 pm
Hi Sachin, Please see this link, i am writing this program in PHP, logic is same. http://www.sachinpuri.com/Algorithm/15/program_to_find_all_armstrong_numbers_(php).html
•  2 Like
•  1 Dislike
• Report
by Shibani on 31-Oct-2012 10:43 am
can strlen be used on int values ? aren't they confined to strings ?
•  1 Like
•  0 Dislike
• Report
by Manish on 31-Oct-2012 01:40 pm
yes in php we can use strlen on int, php is smart enough to convert int in string to calculate length.
•  0 Like
•  0 Dislike
• Report
by Brijesh on 28-Dec-2011 01:19 pm
This is right program....
•  4 Like
•  1 Dislike
• Report
by viv on 13-Oct-2011 03:16 pm
thanx buddy...
•  2 Like
•  1 Dislike
• Report
by Ruchita on 14-Aug-2011 03:10 pm
Wat abt 1digit,2 digit armstrng number??can u help me with it?
•  2 Like
•  2 Dislike
• Report
by Sachin Puri on 16-Aug-2011 01:45 pm
An Armstrong number is an n digit number, which is equal to the sum of the nth powers of its digits. All the 1 digit numbers (1-9) are Armstrong number because 1*1=1 which is equals to number (1) itself, 2*1=2 which is equals to number(2) itself so on for all the 1 digit numbers (1-9).There are no 2 digit Armstrong numbers. Feel free to ask me if you still have doubt.
•  4 Like
•  14 Dislike
• Report
by Rajender Singh on 02-Sep-2012 04:03 pm
hello sachin,could you give me the program of the armstrong number for the above definition
•  1 Like
•  0 Dislike
• Report
by shraddha shikerkar on 02-Nov-2010 08:44 am
can u pls explain me wt is armstrong no an how the above program works? with d simplest example.
•  2 Like
•  2 Dislike
• Report
by Sachin Puri on 01-Apr-2011 09:34 pm
Example is given in intro. Example :- 153 contains three digits 1,5,3 the cube of 1 is 1 because 1x1x1=1, and cube of 5 is 125 because 5x5x5=125 and cube of 3 is 27 because 3x3x3=27 now add all the cubes 1 125 27=153 which is equals to number itself
•  175 Like
•  107 Dislike
• Report
by Sachin Puri on 08-Nov-2010 04:27 pm
To run this program simply copy paste it in notepad and save it "armstrong.c" now compile it with any C compiler like TC (Turbo C) and then run the program
•  5 Like
•  13 Dislike
• Report
ALGORITHMS

Warning: include(ads/adbrite_300_250.php): failed to open stream: No such file or directory in /home/allie131/public_html/sachinpuri.com/pages/algorithm.php on line 33

Warning: include(ads/adbrite_300_250.php): failed to open stream: No such file or directory in /home/allie131/public_html/sachinpuri.com/pages/algorithm.php on line 33

Warning: include(): Failed opening 'ads/adbrite_300_250.php' for inclusion (include_path='.:/opt/alt/php56/usr/share/pear:/opt/alt/php56/usr/share/php') in /home/allie131/public_html/sachinpuri.com/pages/algorithm.php on line 33