Public Class Form1
Dim n, i, s
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
n = Val(TextBox1.Text)
For i = 1 To n
s = s + i
Next
TextBox2.Text = s
End Sub
End Class
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
n = Val(TextBox1.Text)
For i = 1 To n
s = s + i
Next
TextBox2.Text = s
End Sub
End Class
Public Class Form1
回覆刪除Dim n, i, s
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
n = Val(TextBox1.Text)
For i = 1 To n
s = s + i
Next
TextBox2.Text = s
End Sub
程式稍做縮排,看起來比較舒服。
End Class