码迷,mamicode.com
首页 > 其他好文 > 详细

有一个3*4的矩阵,要求编程序求出其中值最大的那个元素的值,以及其所在的行号和列号

时间:2020-02-06 12:26:21      阅读:436      评论:0      收藏:0      [点我收藏+]

标签:printf   ++   void   nbsp   style   span   for   int   bsp   

#include "stdio.h"
void main()
{
    int a[3][4]={{65,48,78,90},{78,92,45,66},{77,44,66,55}};
    int i,j,max=a[0][0],row,colum;
    for(i=0;i<3;i++)
    {
      for(j=0;j<4;j++)
      {
        if(a[i][j]>max)
        {
          max=a[i][j];
          row=i;
          colum=j;
        }    
      }
    }
    printf("max:%d\nrow:%d\ncolum:%d\n",max,row,colum);
}

 

有一个3*4的矩阵,要求编程序求出其中值最大的那个元素的值,以及其所在的行号和列号

标签:printf   ++   void   nbsp   style   span   for   int   bsp   

原文地址:https://www.cnblogs.com/zyz322/p/12268095.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!