看板 MATLAB 關於我們 聯絡資訊
想請益如何用while loop 計算1+2+3+....+999 謝謝 -- ※ 發信站: 批踢踢實業坊(ptt.cc), 來自: 140.122.34.242 ※ 文章網址: https://www.ptt.cc/bbs/MATLAB/M.1491930300.A.FFA.html
ntumath: num = 1; 04/12 11:54
ntumath: result = 0; 04/12 11:54
ntumath: while num < 1000 04/12 11:54
ntumath: result = result + num 04/12 11:54
ntumath: num += 1; 04/12 11:54
ntumath: end 04/12 11:55