vb 求 1×2×3×.×99×100=Private Sub Form_Click()Dim i As IntegerDim sum As Integersum = 1For i = 1 To 100 Step 1sum = sum * iNext iEnd Sub 这个有什么问题啊?

来源:学生作业帮助网 编辑:作业帮 时间:2024/11/27 06:00:36
vb 求 1×2×3×.×99×100=Private Sub Form_Click()Dim i As IntegerDim sum As Integersum = 1For i = 1 To 100 Step 1sum = sum * iNext iEnd Sub  这个有什么问题啊?
x)+KRxItӍO;ٱٜ'x9}E3NI*X<.%ѝ Du;X0/Āz &3;!@=OzɎ]Ϧny:EzȞYv-zھ§[_. W_ay)N%%y$E D\_ab@Ĩ~qAb8t!Cz

vb 求 1×2×3×.×99×100=Private Sub Form_Click()Dim i As IntegerDim sum As Integersum = 1For i = 1 To 100 Step 1sum = sum * iNext iEnd Sub 这个有什么问题啊?
vb 求 1×2×3×.×99×100=
Private Sub Form_Click()
Dim i As Integer
Dim sum As Integer
sum = 1
For i = 1 To 100 Step 1
sum = sum * i
Next i
End Sub
这个有什么问题啊?

vb 求 1×2×3×.×99×100=Private Sub Form_Click()Dim i As IntegerDim sum As Integersum = 1For i = 1 To 100 Step 1sum = sum * iNext iEnd Sub 这个有什么问题啊?
sum定义为整型肯定会溢出的
必须定义为double
Private Sub CommandButton1_Click()
Dim i As Integer
Dim sum As Double
sum = 1
For i = 1 To 100 Step 1
sum = sum * i
Next i
TextBox1.Text = sum
End Sub