Page 129 -
P. 129
附錄四:11900 電腦軟體設計丙級學科題庫(105 年新版)
i=i+1
Loop
If y = 2 Then
t03.Text = "第三題結果:" & x & " is a prime number."
Else
t03.Text = "第三題結果:" & x & " is not a prime number."
End If
【程式碼-改成 Do… Loop While 後測式-迴圈】部份程式
Dim x, y As Integer
FileOpen(1, "c:\丙設磁片\940303.sm", OpenMode.Input)
Input(1, x)
FileClose(1)
Dim i
Do
If x Mod i = 0 Then y = y + 1
i=i+1
Loop While i<=x
If y = 2 Then
t03.Text = "第三題結果:" & x & " is a prime number."
Else
t03.Text = "第三題結果:" & x & " is not a prime number."
End If
125