Current location - Plastic Surgery and Aesthetics Network - Plastic surgery and medical aesthetics - Customize a 4*4 two-dimensional integer array, print it out first, and then find the minimum value of each line to form a new one-dimensional array and print it out?
Customize a 4*4 two-dimensional integer array, print it out first, and then find the minimum value of each line to form a new one-dimensional array and print it out?
C language code is as follows:

` ` c

# include & ltstdio.h & gt

int main() {

int arr[4][4] = {{7,6, 12,8},

{23, 4, 7, 15},

{3, 8, 6, 9},

{ 17, 0, -6, 1}};

int minrar[4]= { 0 }; //Store the minimum value of each row.

//Print two-dimensional array

for(int I = 0; I<4; i++) {

for(int j = 0; j & lt4; j++) {

printf("%d\t ",arr[I][j]);

if (j == 3) {

printf(" \ n ");

}

}

}

//Find the minimum value of each row and store it in a one-dimensional array.

for(int I = 0; I<4; i++) {

minar r[I]= arr[I][0];

for(int j = 1; j & lt4; j++) {

if(arr[I][j]& lt; minar[I]){

minar r[I]= arr[I][j];

}

}

}

//Print a one-dimensional array

for(int I = 0; I<4; i++) {

printf("%d\t ",minArr[I]);

}

Returns 0;

}

```

The output result is:

```

7 6 12 8

23 4 7 15

3 8 6 9

17 0 -6 1

6 4 3 -6

```