输出1000以内的水仙花数

//输出1000以内的水仙花数
#include <stdio.h>
#include <math.h>
int main(){
    int a,b,c,s,i;
    printf("水仙花数如下:\n");
    for(i=100;i<=999;i++){
        a=i/100;
        b=(i/10)%10; 
        c=i%10;
        if(i==a*a*a+b*b*b+c*c*c) printf("%d\n",i);
    }
    return 0;
} 

收录于文章《885程序设计考点狂背总目录中

posted @ 2020-07-27 15:44  薄眠抛却陈年事。  阅读(897)  评论(0编辑  收藏  举报