【正文】
數? ? …… ? 999是水仙花數? 求所有水仙花數算法 開始 I>= 1000? 結束 是 否 I?100 求出 I的個位 a,十位 b和個位 c a3+b3+c3=I? 是 輸出 I I?I+1 循環(huán)結構 求水仙花數的程序 ? Dim I as integer,a as integer,b as integer,c as integer ? For i=100 to 999 ? a=i \100 ? b=(i mod 100) \10 ? c=(i mod 100) mod 10 ? if a^3+b^3+c^3=i then print I ? Next I 求 i的三個位數字