Explore
ProGrad Programs
Placement Prep
TCS Codevita
Webinars
About Us

Edit
Reply




Edit

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

Published on 11 Mar 2020

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


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


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


C
C++
Java
Python 3

Output
Enter the order of the matrix : 3 3
Input matrix elements :
1 2 3
4 5 6
7 8 9
3
6
9



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


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


C
C++
Java
Python 3

Output
Enter the order of the matrix : 3 3
Input matrix elements :
1 2 3
4 5 6
7 8 9
1
4
7


Recommended Programs







If you have any feedback about this article and want to improve this, please write to enquiry@faceprep.in