Program to find the minimum and maximum element in each row of a matrix

Program to find the minimum and maximum element in each row of a matrix

The program to find the minimum and maximum element in each row of a matrix is discussed here. Given a matrix, the maximum and minimum elements of each row of the matrix are displayed as output.

Program to find the minimum and maximum element in each row of a matrix


Maximum element in each row of the matrix

Input:

3 3 (Order of the matrix – number of rows and columns)

1 4 9

3 5 1

2 8 5

Output:

9

5

8


face prep proClick here to learn more about FACE Prep PRO


Algorithm to find the maximum element in each row of a matrix

  • Input the order of the matrix.
  • Input the matrix elements.
  • For row = 0 to n-1
  • Find the maximum element in the row and insert the element in an array.
  • Print the array.


Program to find the maximum element in each row of a matrix

@@coding::1@@


The minimum element in each row of a matrix

Input:

3 3 (Order of the matrix – number of rows and columns)

1 4 9

3 5 1

2 8 5

Output:

1

1

2


face prep pro ad banner

Algorithm to find the minimum element in each row of a matrix

  • Input the order of the matrix.
  • Input the matrix elements.
  • For row = 0 to n-1
  • Find the minimum element in the row and insert the element in an array.
  • Print the array.

Program to find the minimum element in each row of a matrix

@@coding::2@@



Recommended Programs



Program to find the minimum and maximum element in each row of a matrix