为了账号安全,请及时绑定邮箱和手机立即绑定

哪里输入错误

#include <stdio.h>
int main()
{
    //定义三位数num,个位数sd,十位数td,百位数hd
    int num, sd, td, hd;
    //循环所有三位数
    for( num=100   ;  num<1000   ;    num++  )
    {
        //获取三位数字num百位上的数字
        hd =        num/100         ;
        //获取三位数字num十位上的数字
        td =        num%100/10         ;
        //获取三位数字num个位上的数字
        sd =     num%10         ;
        //水仙花数的条件是什么?
        if( sd*sd*sd+td*td*td+hd*hd*hd==num             )
        {
            printf("水仙花数字:%d\n", num);   
        }
    }
    return 0;   

正在回答

1 回答

return 0;后面少了一个花括号

0 回复 有任何疑惑可以回复我~

举报

0/150
提交
取消

哪里输入错误

我要回答 关注问题
意见反馈 帮助中心 APP下载
官方微信