批踢踢實業坊
›
看板
MATLAB
關於我們
聯絡資訊
返回看板
作者
chris100466 (chris)
看板
MATLAB
標題
[討論] while用法
時間
Wed Apr 12 01:04:57 2017
想請益如何用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