天天看點

用vb程式設計輸出100以内素數和

代碼:

Private Function Judge()

Dim b As Integer

b = b / 1 * b

End Function

Private Sub Command1_Click()

  Dim a As Integer, b As Integer

  Show

  a = 0: b = 1

  If Judge(b <> 0) Then

  Do

  a = a + b

  b = b + 1

  Loop While b <= 100

  End If

  Label2.Caption = a

End Sub

心得體會:通過本次學習,我明白了什麼是循環結構。并懂得了基本循環結構的編寫。