📅  最后修改于: 2022-03-11 14:44:46.640000             🧑  作者: Mango
#include
int main(void)
{
int rows, cols;
do
{
printf("Give me the number of rows :");
scanf("%d",&rows);
}while(rows<1);
do
{
printf("Give me the number of cols :");
scanf("%d",&cols);
}while(cols<1);
int arr[rows][cols];
printf("\nThe filling of the Matrix :\n");
for (int i = 0; i < rows; i++)
{
for (int j = 0; j < cols; j++)
{
scanf("%d", &arr[i][j]);
}
}
int i_max = 0,j_max=0;
int i_min = 0,j_min=0;
int max=arr[0][0];
int min=arr[0][0];
for (int i = 0; i < rows; i++)
{
for (int j = 0; j < cols; j++)
{
if (arr[i][j]>max)
{
max=arr[i][j];
i_max=i;// i_max mean's the index i of the maximum element
j_max=j;// j_max mean's the index j of the maximum element
}
if(arr[i][j]