我目前有這個類創建稱爲陣列數學加載到10x10陣列的位置乘法的位置顯示在代碼中顯示的圖像,但是我想要做的是劃分每個乘以2後的位置。換句話說,在當前時刻(行*列)/ 2,我只是將這些數字加載到數組中。我不知道如何處理這個邏輯,因爲我使用兩個for循環來產生行和列之間的乘法。二維數組(乘法/除法)
class ArrayMath
{
private static final int tableSize = 10;
public static void main(String[] args)
{
int table[][] = new int [tableSize][tableSize];
for (int row = 1; row <= 10; row++)
{
for (int col = 1; col <= 10; col++)
{
System.out.printf(row * col +"\t");
}
System.out.println();
}
}
}
我不確定要理解。你的預期產出是多少? –