public static void main(String[] args) {
// 输入4行4列的矩阵 求主对角线元素的乘积与副对角线元素的乘积
int[] []array = new int[8][8];
Random rd=new Random();
for (int i = 0; i < array.length; i++) {
for (int j = 0; j < array.length; j++) {
array[i][j]=rd.nextInt(100);//100代表100以内的数
}
//System.out.println(Arrays.toString(array[i]));
}
//打印这个矩阵
for (int i = 0; i < array.length; i++) {
for (int j = 0; j < array.length; j++) {
System.out.print(array[i][j]+"\t");
}
System.out.println();
}
int temp=1;
int temp2=1;
for (int i = 0; i < array.length; i++) {
temp*=array[i][i];
}
System.out.println(temp);
for (int i = 0; i < array.length; i++) {
temp2*=array[i][8-i-1];
}
System.out.println(temp2);
}