用C语言编程:3行4列的二维数组中输出每一行的最大值怎么编程呀

 我来答
望穿秋水待伊人
2010-05-06 · TA获得超过644个赞
知道小有建树答主
回答量:708
采纳率:100%
帮助的人:776万
展开全部
int a[3][4],m=0;
for(int i=0;i<3;i++;)
{ for(int j=0;j<4;j++;)
{
if(m<a[i][j]) m=a[i][j];
}
printf("第%d行的最大值为:%d ",i+1,m);
m=0;
}
这个只对都是大于0的数有效,要有负数你就修改下吧
百度网友e4c29a2ee
2010-05-08 · TA获得超过164个赞
知道答主
回答量:62
采纳率:0%
帮助的人:74.1万
展开全部
#include "stdio.h"

#define N1 3
#define N2 4

void main()
{
int i,j,num[N1][N2],temp;

printf("输入行列元素值:");

for(i=0;i<N1;i++)
{
for(j=0;j<N2;j++)
{
scanf("%d",&num[i][j]);
}
}

printf("输入的行列是:\n");

for(i=0;i<N1;i++)
{
for(j=0;j<N2;j++)
{
printf("%5d",num[i][j]);
}

printf("\n");
}

for(i=0;i<N1;i++)
{
temp=num[i][0];

for(j=1;j<N2;j++)
{
if(temp<num[i][j])
{
temp=num[i][j];
}
}

printf("第%d行最大值:%d\n",i+1,temp);
}
}
已赞过 已踩过<
你对这个回答的评价是?
评论 收起
居照靖弘懿
2019-04-08 · TA获得超过3700个赞
知道小有建树答主
回答量:3084
采纳率:26%
帮助的人:183万
展开全部
#include<stdio.h>
main()
{
int
array[3][4];
int
i,j,max;
for(i=0;i<3;i++)
for(j=0;j<4;j++)
scanf("%d",&array[i][j]);
for(i=0;i<3;i++)
{
max
=
array[i][0];
for(j=0;j<4;j++)
{
if(array[i][j]>max)
max
=
array[i][j];
}
printf("The
max
num
of
line
%d
is
:
%d\n",i,max
);
}
}
已赞过 已踩过<
你对这个回答的评价是?
评论 收起
清秀还靓丽的光芒9554
2010-05-06
知道答主
回答量:16
采纳率:0%
帮助的人:0
展开全部
#include<stdio.h>
main()
{
int array[3][4];
int i,j,max;
for(i=0;i<3;i++)
for(j=0;j<4;j++)
scanf("%d",&array[i][j]);

for(i=0;i<3;i++)
{
max = array[i][0];
for(j=0;j<4;j++)
{
if(array[i][j]>max)
max = array[i][j];
}
printf("The max num of line %d is : %d\n",i,max );
}
}
本回答被提问者采纳
已赞过 已踩过<
你对这个回答的评价是?
评论 收起
369玲玲963
2020-04-25
知道答主
回答量:1
采纳率:0%
帮助的人:581
展开全部
👍👍👍💋💋💋💑
已赞过 已踩过<
你对这个回答的评价是?
评论 收起
收起 1条折叠回答
收起 更多回答(3)
推荐律师服务: 若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询

为你推荐:

下载百度知道APP,抢鲜体验
使用百度知道APP,立即抢鲜体验。你的手机镜头里或许有别人想知道的答案。
扫描二维码下载
×

类别

我们会通过消息、邮箱等方式尽快将举报结果通知您。

说明

0/200

提交
取消

辅 助

模 式