Hi Friends,
here I'm posting one of the frequently asking question in CUSAT B tech C programming ( s 1 s2 ) and its solution:
Question:
Solution:
#include<stdio.h>
main()
{
int number, temp, digit=0, dup;
printf("Printing all Armstrong numbers between 1 and 500:\n\n");
number = 1;
while (number <= 500)
{
temp=0;
dup=number;
while(dup>0)
{
digit=dup%10;
temp+=(digit*digit*digit);
dup=dup/10;
}
if (temp==number)
{
printf("\nAmstrong Number:%d", temp);
}
number++;
}
getch();
}