水仙花数
时间:2014-06-04 15:52:21
收藏:0
阅读:198
#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);
}
评论(0)