06.08.2013 Views

03 林家民

03 林家民

03 林家民

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

題目說明:1+2-3+4+5-6.....97+98-99 的總合為?<br />

檔案名稱:<strong>03</strong> \ ch6 \ P.172-1 延伸 3<br />

表單:<br />

程式碼:<br />

Private Sub Form_Activate()<br />

Dim i As Integer, sum As Integer<br />

sum = 0<br />

For i = 1 To 99<br />

If i Mod 3 = 0 Then sum = sum - i<br />

If i Mod 3 0 Then sum = sum + i<br />

Next i<br />

Print "1+2-3+4+5-6.....97+98-99 的總合為 " & sum<br />

End Sub<br />

執行結果:

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!