VB编写程序,计算并输出下面级数前n项中(n=50)奇数项的和.1*2*3+2*3*4+3*4*5+……+n*(n+1)*(n+2)+…

问题描述:

VB编写程序,计算并输出下面级数前n项中(n=50)奇数项的和.1*2*3+2*3*4+3*4*5+……+n*(n+1)*(n+2)+…

Private Sub Command1_Click()
Dim i As Long,sum As Long
For i = 1 To 50 Step 2
sum = sum + i * (i + 1) * (i + 2)
Next
MsgBox "级数前50项奇数项和为:" & sum
End Sub