4-9水仙花數(shù)
#include <stdio.h>
int main()
{
????int num,hd,td,sd;
????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("水仙花數(shù)字: %d\n",num);
????????}
????}
????return 0;
}
為什么我的編輯器能正確顯示結(jié)果,但是提交總是通不過呢?
2018-07-11
題目當(dāng)中的關(guān)鍵詞一樣
2018-07-09
num < 1000跟num <= 999不是一樣的嗎?