作者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/cn.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