编写程序,计算S=1+2+3+4+……+100 ,并将结果在屏幕打印输出!用VB来编,关键是将结果在屏幕打印输出的代码

2024-11-17 16:28:14
推荐回答(3个)
回答(1):

Private Sub Command1_Click()
Dim s As Double
Dim i As Double
For i = 1 To 100
s = s + i
Next i
Print s
End Sub
是不是这样?

回答(2):

dim i as long,sum as long
for i=1 to 100
sum=sum+i
next
print sum

回答(3):

5050