作者chris100466 (chris)
看板MATLAB
標題[討論] while用法
時間Wed Apr 12 01:04:57 2017
想請益如何用while loop
計算1+2+3+....+999
謝謝
--
※ 發信站: 批踢踢實業坊(ptt.cc), 來自: 140.122.34.242
※ 文章網址: https://webptt.com/m.aspx?n=bbs/MATLAB/M.1491930300.A.FFA.html
1F:推 ntumath: num = 1; 04/12 11:54
2F:→ ntumath: result = 0; 04/12 11:54
3F:→ ntumath: while num < 1000 04/12 11:54
4F:→ ntumath: result = result + num 04/12 11:54
5F:→ ntumath: num += 1; 04/12 11:54
6F:→ ntumath: end 04/12 11:55