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,jx = 0For i = 0 To 1x = x + 1For j = 0 To 3If Not (j Mod 2) Then x = x + 1Next jNext iPrint "x="; xEnd Sub运行后结果
来源:学生作业帮助网 编辑:六六作业网 时间:2024/12/26 16:41: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,jx = 0For i = 0 To 1x = x + 1For j = 0 To 3If Not (j Mod 2) Then x = x + 1Next jNext iPrint "x="; xEnd Sub运行后结果
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.怎么理解啊,
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,jx = 0For i = 0 To 1x = x + 1For j = 0 To 3If Not (j Mod 2) Then x = x + 1Next jNext iPrint "x="; xEnd Sub运行后结果
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