题目内容:
在窗体中添加1个命令按钮(其Name属性为Command1)和1个标签(其Name属性为Lable1),然后编写如下代码: Private Sub Commandl_Cliek() Dim arrayl(10, 10)As Integer Dim i, j, Sum AsIntegerSum=0 For i=1 To 10 Forj=1 To 10arrayl(i, j)=i+j Nextj Next i End Sub 此程序的功能是求数组arrayl主对角线元素的和,并把结果显示在标签中,为实现此功能,省略号处的程序段应该是 ( )
A.For i=1 To 10 For j=1 To 10 If i=j Then Sum = Sum+ arrayl (i, End If Next j Next i Label Caption=Sum
B.For i=l TO 10Forj=1 To 10 If i= =j Then Sum=Sum+array1 (i, End IfNext j Next i Label Caption=Sum
C.For i=1 To 10For j=1 To l0 If i=j Then Sum=Sum+arrayl (i, End IfNext iNext jLahel Caption=Sum
D.For i=1 To 10 For j=1 To l0If i=j ThenSum=arrayl (i,End If Next j Next i Label Caption=Sum
参考答案:
答案解析: