Completely Solved C, C++ Programs Assignment.




C Program to print Armstrong number between 1-500 (Process III)

Filed Under:

Problem 64. C Program to print Armstrong number between 1-500(Process III).
#include<stdio.h>
#include<conio.h>
main( )
{
int i,n,s,r;
clrscr( );
for(i=1;i<=500;i++)
{
n=i;
s=0;
while(n>0)
{
r=n%10;
s=s+(r*r*r);
n=n/10;
}
if(i==s)
printf(“n%d”,s);
}
getch();
}

C compiler: gcc 4.1.2

 Back to main directory: Sample C Program | Software Practical | Solved C Assignment


Get Free Programming Tutorials and Solved assignments