28號 筆記整理
上課日期:3月3日
筆記內容:複習題(迴圈)
1.
S = o
┌For I = 1 To 26 step 2
│ S = S + I
└Next I
Print S
Print I
I
|
S = S + I
|
1
|
S = 0 + 1 = 1
|
3
|
S = 1 + 3 = 4
|
5
|
S = 4 + 5 = 9
|
…
|
|
27
|
|
2.
S =
0:I = 1
┌while I < 100
│ S = S + I
│ I = I + 1
└wend
S=1+2+3+4+5+6+7+8+9+…+99+100
I =100
=101
3.
S =
0:I = 1
┌Do Until I > = 100
│ S = S + I
│ I = I + 1
└LooP
4.
S = 0:I = 1
┌Do
│ S = S + I
│ I = I + 1
└LooP Until I > = 100
Print S,I
(先判斷)
請問:前側迴圈時程是至少會被執行 0 次
後側迴圈時程是至少會被執行 1 次
本文於 修改第 1 次