下列程序: Option Base 1 Private Sub Form_Click() Dim a(5,5) For i = 1 To 5 For j = 1 To 5 k = k + 1 a (i,j)= k Next j Next i For i = 1 To 5 s = s + a (i,i) Next i Print s End Sub 运行时的输出结果是( )。
举一反三
- 下列程序运行后输出结果是_______. Private Sub Form_Click() K=1 For I=5 to 1 step -1 T=T*10 + K S=S+T Next I Print S End sub
- 单击窗体,在窗体上打印数列:2/1 ,3/2 ,5/3 ,8/5 ,13/8 … 的前10项,并求其和,将和保存在变量s中。 Private Sub Form_Click() Dim i%, j%, k%, m As Integer Dim s As Single s = 0 i = 2 'i为分子 j = 1 'j为分母 For k = 1 To 10 s = 【1】 Print i & "/" & j m = j j = i i = 【2】 Next Print s End Sub
- 写输出下面程序的运行结果_ _。 Dim a() As Integer Private Sub Command1_Click() ReDim a(1 To 5) For i = 1 To 5 a(i) = i Next i ReDim a(1 To 10) For i = 6 To 10 a(i) = 2 * i Next i For i = 1 To 10 Print a(i); Next i End Sub
- 下列程序段的执行结果为 _______。 Dim a(3, 5) As Integer Dim i As Integer, j As Integer For i = 1 To 3 For j = 1 To 5 a(i, j) = a(i - 1, j - 1) + (i - 1) * 5 + j Next j Next i Print a(3, 4)
- 下列程序运行时输出的结果是 Option Base 1 Private Sub Form_Click() Dim x (10)As Integer,y(5)As Integer For i=1 to 10 x(i)=10-i+1 Next For i=1 to 5 y(i)=x(2*i-1)+x(2*i) Next For i=1 to 5 Print y(i) Next End Sub A.3 7 11 45 19 B.19 15 11 7 3 C.1 3 5 7 9 D.不确定的值