回覆列表
-
1 # 只是我看你的美
-
2 # 使用者1465424935672
Private Sub Command1_Click()
Dim a(4, 4) As Double
Dim sum1 As Double
For i = 1 To 4
sum = 0
For j = 1 To 4
a(i, j) = Format(Rnd * 89 + 10, "0")
sum = sum + a(i, j)
Print a(i, j);
Next j
Print sum
Next i
For j = 1 To 4
sum = 0
For i = 1 To 4
sum = sum + a(i, j)
Next i
Print sum;
Next j
End Sub
連每個數都輸出了,你自己執行一下看看。
程式如下: #include //定義標頭檔案 void main() //主函式 { int i,j,row = 0 ,colum = 0,max; //定義整型的i,j,定義行列及最大值 int a[3][4]={{1,2,3,4},{9,8,7,6},{-10,10,-5,2}}; //定義一個二維陣列 max = a[0][0]; for(i=0;i