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 /*Programme to find Armstrong number in the range of 0 and 999*/
2 #include <stdio.h>
3 #include <conio.h>
4 void main()
5 {
6 int num,rem,qub,sum=0,i;
7 printf("Armstrong numbers between 0 to 999 are: ");
8
9 for(i=0; i<=999; i++)
10 {
11 num=i;
12 sum=0;
13 while(num>0)
14 {
15 rem=num%10;
16 qub=rem*rem*rem;
17 sum=sum+qub;
18 num=num/10;
19 }
20 if(sum==i)
21 {
22 printf("%d,",sum);
23 }
24 }
25 getch();
26 }
27
28 http://www.sachinpuri.com/Article/61/what_is_an_armstrong_number.html
Add Your Comment
   
    Yes! I want to receive all comments by email

  by elakkiya.m on 28-Sep-2014 02:23 pm
nice idea,good luck for creating new ideas
  • Reply
  •  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
  • Reply
  •  0 Like
  •  0 Dislike
  • Report
  by ammu on 19-Nov-2013 03:56 pm
its tooooo bad
  • Reply
  •  0 Like
  •  3 Dislike
  • Report
  by nakshatra on 19-Nov-2013 03:55 pm
thank uuuuuuuuuuu
  • Reply
  •  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
  • Reply
  •  12 Like
  •  0 Dislike
  • Report
  by ragul on 04-Jul-2013 03:58 pm
thank you
  • Reply
  •  8 Like
  •  0 Dislike
  • Report
  by ragul on 04-Jul-2013 03:57 pm
thank u
  • Reply
  •  5 Like
  •  0 Dislike
  • Report
  by garima moradia on 22-Apr-2013 12:31 pm
thank u .... :)
  • Reply
  •  2 Like
  •  1 Dislike
  • Report
  by Sanjana Desai on 13-Mar-2013 09:21 pm
its easy:)
  • Reply
  •  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
  • Reply
  •  0 Like
  •  1 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
  • Reply
  •  0 Like
  •  0 Dislike
  • Report
  by java67 on 31-Aug-2012 08:03 am
Here is my way of finding Armstrong number in java
  • Reply
  •  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??
  • Reply
  •  2 Like
  •  1 Dislike
  • Report
  by anukul on 25-May-2012 11:02 pm
i love your programming techniques
  • Reply
  •  2 Like
  •  2 Dislike
  • Report
  by kamlesh on 03-Apr-2012 07:51 am
this is my prog
  • Reply
  •  1 Like
  •  3 Dislike
  • Report
  by jesna on 22-Mar-2012 10:28 am
This one is the right program. Thanks for sharing Sachin!
  • Reply
  •  2 Like
  •  1 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
  • Reply
  •  2 Like
  •  1 Dislike
  • Report
  by Brijesh on 28-Dec-2011 01:19 pm
This is right program....
  • Reply
  •  4 Like
  •  1 Dislike
  • Report
  by viv on 13-Oct-2011 03:16 pm
thanx buddy...
  • Reply
  •  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?
  • Reply
  •  2 Like
  •  2 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.
  • Reply
  •  2 Like
  •  2 Dislike
  • Report