用VB计算S=1+2^2+2^3+…+2^10的代码
Private Sub Command1_Click()
Dim i, j, t
Dim sum
sum = 1
For i = 2 To 10
t = 1
For j = 1 To i
t = t * 2
Next j
sum = sum + t
Next i
Print sum
End Sub
Private Sub Command1_Click()
Dim n as Interger
S=1
n=2
For n=2 to 10
S=S+2^n
Next n
Print S
End Sub