[原创][分享]自然数求和公式,VB循环求和
# Sn = n * (n + 1) / 2 'n=最大数msgbox sn=n*(n+1) /2
我发的代码怎么没了
程序代码:
private sub command1_click() L = 0 for i = 1 to 100 L= L + i next i end sub
补上
[ 本帖最后由 tonoy 于 2013-8-28 19:26 编辑 ]
Public Class Form1 Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click Dim l As Integer Dim i As Integer l = 0 For i = 1 To 100 l = l + i Next i MsgBox(l) End Sub End Class饿不懂vb