看板 C_and_CPP 關於我們 聯絡資訊
開發平台(Platform): (Ex: VC++, GCC, Linux, ...) DEV C++ 額外使用到的函數庫(Library Used): (Ex: OpenGL, ...) 問題(Question): 迴圈排列 餵入的資料(Input): 預期的正確結果(Expected Output): 1 12 123 1234 12345 123456 錯誤結果(Wrong Output): 1 12 123 1234 12345 123456 程式碼(Code):(請善用置底文網頁, 記得排版) int main() { int i=1,j=1; for(i=1;i<=6;i++) { for(j=1;j<=i;j++) { printf("%d",j); } printf("\n"); } 補充說明(Supplement): 目前錯誤的結果是我程式碼裡面寫的,那怎麼改成正確結果,請高手指導一下,感謝! -- ※ 發信站: 批踢踢實業坊(ptt.cc), 來自: 49.159.133.241 ※ 文章網址: https://www.ptt.cc/bbs/C_and_CPP/M.1430841534.A.867.html
LPH66: 你沒有印對應數量的空白; 要印多少可以思考一下 05/06 00:08
LPH66: 如果還是轉不過來的話, 試試比較簡單的: 數字前面都是 '*' 05/06 00:09
bigpigbigpig: 你可以考慮把 for(j=1;j<=i;j++) 改成 countdown :) 05/06 09:05
drunksaber: 可以了,謝謝!! 05/06 18:21