/************************************************************************
*																		*
* Matrix matrisinin her satirinin en buyuk elemanini bulur				*
* derlemek icin: gcc -o program_ismi 5.c								*
*																		*
************************************************************************/

#include <stdio.h>

int main()
{
  /*  int Matrix[4][5]={
	                 {2,6,9,7,9},
	                 {7,3,8,3,6},
	                 {5,1,4,2,3},
	                 {5,2,7,3,1}
                     };             */
    
    int row_number, col_number;
    
    printf("satir sayisini giriniz:\n");
    scanf("%d", &row_number);                 

    printf("kolon sayisini giriniz:\n");
    scanf("%d", &col_number);
    
    int Matrix[row_number][col_number], Max[row_number], row, col;
    
    for (row=0; row<row_number; row++) {
        printf("%d. satiri giriniz:\n", row+1);
        for (col=0; col<col_number; col++)
          scanf("%d", &Matrix[row][col]);
          } 
        
    printf("\nMatrix:\n");
    
    //her satirin max elemanlari bulunuyor ve Max dizisinde tutuluyor
	for (row = 0; row < row_number; row++){
		Max[row] = Matrix[row][0];
        for (col = 1; col < col_number; col++)
        	if (Max[row] < Matrix[row][col]) 
	       		Max[row]= Matrix[row][col];
    }

	//Matrix matrisi ekrana yaziliyor
    for (row = 0; row < row_number; row++){
    	for (col = 0; col < col_number; col++)
        	printf("%d ", Matrix[row][col]);
          printf("\n");
    }
    
    printf("\nMax:\n");
    
    //Max dizisi ekrana yaziliyor
    for (row = 0; row < row_number; row++)
    	printf("%d ", Max[row]);
    printf("\n");
    
    system("pause");
    return 0; 
}
