我有二维数组
private static int [][] n = {{1, 2, 3, 4}, {5, 6, 7, 8}};
我也有
int m = 3;
如何将二维数组中的每个元素乘以3?
所以输出会是这样的:
{{3, 6, 9, 12},{15, 18, 21, 24}}
另外,如果我有一个矩阵
{{1, 2, 3, 4, 5},
{6, 7, 8, 9, 10},
{11, 12, 13, 14, 15},
{16, 17, 18, 19, 20},
{21, 22, 23, 24, 25}},
如何打印对角线元素?
{1,7,13,19,25} and {5,9,1