定义二维数组 int array[3][4],从键盘输入整数给array赋值,并求数组array中

2024-12-16 16:58:57
推荐回答(1个)
回答1:

int result1 = result2 = a[0][0];
for(int i = 0; i< 3; i++)
{
for(int j = 0; j < 4; j++)
{
if(a[i][j] > result1)
{
result1 = a[i][j];
}
else if(a[i][j] < result2)
{
result2 = a[i][j];
}
}
}