用vb编程实现s=1x2+2x3+3x4+……+(n-1)xn

2024-11-29 21:44:51
推荐回答(1个)
回答1:

Dim S As Double
Dim n As Long
Dim i As Long
S = 0
n = CLng(InputBox("表输入一个大于1的正整数"))
For i = 2 To n
S = S + (n - 1) * n
Next
Print S