VB编程求代码,一个数组有十个元素。1,3,5,7,9,11,13,15,17,19先在屏幕上产生

2024-11-14 23:30:03
推荐回答(2个)
回答(1):

Private Sub Command1_Click()
Dim a(9), temp
For i = 0 To 9
a(i) = i * 2 + 1
Print a(i);
Next i
Print Chr(10)
For i = 0 To 9
If i < 5 Then
temp = a(i)
a(i) = a(i + 5)
a(i + 5) = temp
End If
Print a(i);
Next i
End Sub

回答(2):

Private Sub command1_click()
msgbox "1,3,5,7,9,11,13,15,17,19"
msgbox "11,13,15,17,19,1,3,5,7,9,11"
End Sub