free c programming course
Thursday, 18 August 2011
Print Armstrong numbers Less Than 1000
#include<stdio.h>
#include<conio.h>
void main()
{
int q,a,b,c,z,x,n=1;
clrscr();
printf(" OUTPUT :");
while(n<1000)
{
a=n%10;
q=n/10;
b=q%10;
c=q/10;
z=((c*100)+(b*10)+a);
x=(a*a*a)+(b*b*b)+(c*c*c);
if(x==z)
printf("\n\t%d",n);
n++;
}
getch();
}
No comments:
Post a Comment
Newer Post
Older Post
Home
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment