返回一个二维整数数组的最大整数组的最大值
程序代码:
#include<stdio.h>
#include<string.h>
#define M 3
#define N 3
void main()
{
int a[M][N];
int sum=0;
int tmp=0;
for (int i=0;i<M;i++ )
for (int j=0;j<N;j++ )
scanf("%d",&a[i][j]);
for (int i=0;i<M;i++ )
{
tmp=0;
for ( int j=0;j<N;j++ )
if ( a[i][tmp]<a[i][j] )
tmp=j;
printf("The max num of Line %d is %d\n",i+1, a[i][tmp]);
sum+= a[i][tmp];
}
printf("The sum is %d\n",sum);
}