int sum = 0;
for(int n = 1 ; n < = 20 ; n++)
{
sum += n * (n + 1) * (n +2);
}
伪代码,转成其他的也差不多
Private Sub Form_Click()
Dim n As Integer
n = Val(InputBox("请输入求和的值"))
s = 0
For i = 1 To n
s = s + i * (i + 1) * (i + 2)
Next i
Print "s="; s
End Sub
n=20
s=0
for i=1 to n
s=s+i*(i+1)*(i+2)
next i
print s
Private Sub Command1_Click()
Dim n%, i%, y%, a%
a = 0
y = 1
n = Val(text1.Text)
For i = 1 To n
a = a + 1
y = y * a
Next i
End Sub