void main()
{
int i,j,k;
for(i=1;i<=9;i++)
for(j=0;j<=9;j++)
for(k=0;k<=9;k++)
{
if(i*i*i + j*j*j +k*k*k == 100*i+10*j+k)
printf("%d 是水仙花数.\n",100*i+10*j+k);
}
getche();
}
#include
void main()
{
int a,b,c;
int i;
for(i=100;i<=999;i++)
{
a=i%10;
c=i/100;
b=(i-c*100)/10;
if(a*a*a+b*b*b+c*c*c==i){
printf("%d ",i);
}
}
}
#include
void main() {
for (int i = 100; i < 1000; i++) {
int n1, n2, n3;
int k = i;
n1 = k / 100;
k %= 100;
n2 = k / 10;
k %= 10;
n3 = k;
if (i == (n1*n1*n1+ n2*n2*n2 + n3*n3*n3)) {
printf("%d ",i);
}
}
}