/* Title Description: Write a program to enter a matrix of MXN to store and output, and to find the maximum value per row and the sum of each line. The sum of each row is required to be placed at the maximum value of each row, and if there are multiple maximums, remove the one with the lowest value as the maximum value. Finally, the result matrix is output. Input: The first line of input consists of two integers m and n (1<=m,n<=100), representing the dimensions of the rows and columns of the matrix, respectively. The next m row has n numbers for each row, representing the elements of the matrix. Output: There may be more than one set of test data, for each set of data, the output of the matrix after the execution of the topic requirements. Sample inputs: 3 31 1 11 1 11 1 13 33 2 32 3 23 2 3 Sample output: 3 1 1 1 2 7 2 3*/# include <stdio.h>int main (void) {int M,n,temp = 0,max = 0,flag = 0;int matrix[100][100] = {0};while (scanf ("%d%d", &m, &n)! = EOF) {GetChar (); Absorbs the carriage return character. if ((M <= 0) && (n <= 0)) Break;int i,j;for (i = 0; i < m; i++) {for (j = 0; J < N; j + +) {scanf ("%d", & MATRIX[I][J]);}} for (i = 0; i < m; i++) {for (j = 0; J < N; j + +) {temp = temp + matrix[i][j];} max = matrix[i][flag];for (j = 0; J < N; j + +) {if (Max < matrix[i][j]) flag = j;} Matrix[i][flag] = temp;temp = 0;flag = 0;} for (i = 0; i < m; i++) {for (j = 0; J < N; j + +) {printf ("%d", Matrix[i][j]);} printf ("\ n");}} return 0;}
1191 Matrix Maximum Value