求水仙花数

来源:互联网 发布:通达信日线数据 编辑:程序博客网 时间:2024/06/05 21:08
#include <stdio.h>int main(){    int x,a,b,c;    for(x=100;x<1000;x++)    {        a=x/100;        b=(x%100)/10;        c=x%10;        if(a*a*a+b*b*b+c*c*c==x)            printf("%d\n",x);    }    return 0;}

这里写图片描述

原创粉丝点击