#include <stdio.h>
void main()
{
int a[4][4], i, j, sum = 0, max, max_x = 0, max_y = 0;
long pro = 1;
printf("enter: ");
for(i = 0; i < 4; i++)
for(j = 0; j < 4; j++)
scanf("%d", &a[i][j]); //输入
max = a[0][0]; //初始化max
for(i = 0; i < 4; i++)
for(j = 0; j < 4; j++)
if(i == j || i + j == 3) { //判断是否在对角线上
sum = sum + a[i][j]; //计算和
if(i%2 == 0 && j%2 == 0) //判断下标是否都为偶数
pro = pro * a[i][j]; //计算积
if(a[i][j] > max) { //找最大数
max = a[i][j];
max_x = i;
max_y = j;
} //如果最大数不止一个,将输出坐标最大的那个的坐标
printf("\nsum = %d;\nproduct = %ld;\nmaxnumber = %d, located in (%d, %d).", sum, pro, max, max_x, max_y);
}
追问真的吗?