See the full set of "C language problem sets"
Topic:
Print out all the "Narcissus number", the so-called "Narcissus number" refers to a three-digit, its members of the digital cubic and equal to the number itself. For example: 153 is a "narcissus number", because the 153=1 three times side +5 of three times +3 of the three times side.
1. Procedure Analysis:
Use for loop control 100-999 number, each number is decomposed into single-digit, 10 bits, hundred.
2. Program Source code:
#include "stdio.h"
#include "conio.h"
Main ()
{
int i,j,k,n;
printf ("' Water Flower ' number is:");
for (n=100;n<1000;n++)
{
i=n/100;/* decomposition of the Hundred * *
j=n/10%10;/* decomposition of 10-bit * *
k=n%10;/* decomposition out of a bit * *
if (i*100+j*10+k==i*i*i+j*j*j+k*k*k)
printf ("%-5d", N);
}
Getch ();
}
3.Visual C + + 6.0 debugging pass, as shown in figure: