Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <stdio.h>
- #include <conio.h>
- void main()
- {
- int n,copy,sum,x,j;
- for(j=1;j<=500;j=j+1)
- {
- sum=0;
- n=j;
- copy=n;
- for(;n>0;)
- {
- x=n%10;
- n=n/10;
- sum=sum+(x*x*x);
- }
- if(sum==copy)
- {printf("%d is an Armstrong number\n",sum);}
- }
- getch();
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement