问答详情
源自:4-9 循环结构之for循环(二)

4.9编程题求解答

4.9编程题求解答!

提问者:慕粉2146478508 2017-03-25 14:40

个回答

  • CocoaCat
    2017-03-25 16:19:28

    #include <stdio.h>

    int main()

    {

        int num, sd, td, hd;

        for(num=100  ;  num<1000   ;    num++  )

        {

            hd =       num/100         ;

            td =        num%100/10         ;

            sd =        num%10         ;

            if(     num==hd*hd*hd+td*td*td+sd*sd*sd                 ) 

            {

                printf("水仙花数字:%d\n", num);    

            }

        }

        return 0;    

    }