作业帮 > 数学 > 作业

Private Sub Form_click() Dim x,i,j x = 0 For i = 0 To 1 x =

来源:学生作业帮 编辑:作业帮 分类:数学作业 时间:2024/11/08 07:46:29
Private Sub Form_click() Dim x,i,j x = 0 For i = 0 To 1 x = x + 1 For j = 0 To 3 If Not (j Mod 2)
Private Sub Form_click()
Dim x,i,j
x = 0
For i = 0 To 1
x = x + 1
For j = 0 To 3
If Not (j Mod 2) Then x = x + 1
Next j
Next i
Print "x="; x
End Sub运行后结果为10.怎么理解啊,
Dim x,i,j '定义三个变量
x = 0 'x初始化
For i = 0 To 1 '外循环两次
x = x + 1 'x+2
For j = 0 To 3 '0~3共4次 2*4=8次
If Not (j Mod 2) Then x = x + 1 '只有当not(-1)才不x+1,本题目不可能j mod 2=-1,所以循环8次,x+8
Next j
Next i
Print "x="; x 'x=10