水仙花数的打印
#include<stdio.h>
int main()
{
int num = 0;
int i = 0;
int j = 0;
int k =0;
for(num=1;num<=1000;num++)
{
i = num/100;
j = num/10-i*10;
k = num%10;
if(i*i*i+j*j*j+k*k*k==num)
printf("%d ",num);
}
return 0;
}
int main()
{
int num = 0;
int i = 0;
int j = 0;
int k =0;
for(num=1;num<=1000;num++)
{
i = num/100;
j = num/10-i*10;
k = num%10;
if(i*i*i+j*j*j+k*k*k==num)
printf("%d ",num);
}
return 0;
}