C语言求二维数组的和及最大值

/*Finding the two arrys's max and sum*/
#include<stdio.h>
#include<stdlib.h>
int main() {
	int arrys[2][3],sum=0,max,x,y;
	printf("Please put the arrys:\n");
	for(x=0; x<2; x++)
		for(y=0; y<3; y++)
			scanf("%d",&arrys[x][y]);
	for(x=0; x<2; x++)//Finding the max and calculatting the sum//
		for(y=0; y<3; y++) {
			if(max<arrys[x][y])
				max=arrys[x][y];
			sum=sum+arrys[x][y];
		}
	printf("max=%d sum=%x\n",max,sum);//output format//
	system("pause");
	return 0;
}
发布了16 篇原创文章 · 获赞 0 · 访问量 1579

猜你喜欢

转载自blog.csdn.net/weixin_45713352/article/details/104458678