Fill a two-dimensional numeric array C (6, 6) with integers. Find the column with the greatest

Fill a two-dimensional numeric array C (6, 6) with integers. Find the column with the greatest product of elements and swap it with the first column.

#include <stdio.h> // printf
#include <stdlib.h> // rand
#include <time.h>
#define M_SZ 6
#define N_SZ 6
int main ()
{
int i, j, index, mul = 0, tmp;
int array [M_SZ] [N_SZ];
time_t t;
srand ((unsigned) time (& t));
for (i = 0; i <M_SZ; i ++) // write random numbers into the array
for (j = 0; j <N_SZ; j ++)
array [i] [j] = rand ()% 10; // not exceeding 10
for (i = 0; i <M_SZ; i ++) {// display the array in the form of a plate
for (j = 0; j <N_SZ; j ++)
printf (“% – 6d”, array [i] [j]);
printf (“\ n”);
}
printf (“\ n”);
for (j = 0; j <N_SZ; j ++) {// iterate through the columns
tmp = 1;
for (i = 0; i <M_SZ; i ++) // go through the lines i
tmp * = array [i] [j]; // column j and calculate the product
if (tmp> mul) {// if the product for the given column
mul = tmp; // more previous
index = j; // remember its number
}
printf (“% – 6d”, tmp); // display works for debugging
}
printf (“\ n \ n”);
if (index! = 0) // if the found column is not the first
for (i = 0; i <M_SZ; i ++) {// change it with the first
tmp = array [i] [0];
array [i] [0] = array [i] [index];
array [i] [index] = tmp;
}
for (i = 0; i <M_SZ; i ++) {// display the array in the form of a plate
for (j = 0; j <N_SZ; j ++)
printf (“% – 6d”, array [i] [j]);
printf (“\ n”);
}
return 0;
}



One of the components of a person's success in our time is receiving modern high-quality education, mastering the knowledge, skills and abilities necessary for life in society. A person today needs to study almost all his life, mastering everything new and new, acquiring the necessary professional qualities.