#include <stdio.h>
int main(void){
int
bw,sw,gw;
int i;
int
count=0;
for(i=100;i<=999;i++){
bw=i/100;
sw=i%100/10;
gw=i%10;
if(bw*bw*bw+sw*sw*sw+gw*gw*gw==i){
printf("%d\n",i);
count++;
}
}
printf("100-999有%d个水仙花数\n",count);
}
原文地址:http://www.cnblogs.com/sky8-/p/3764771.html