Explore
ProGrad Programs
Placement Prep
TCS Codevita
Webinars
About Us

Edit
Reply




Edit

Find the minimum and maximum element in each column of a matrix.

Published on 11 Mar 2020

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


Maximum element in each column 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:

3

8

9


Algorithm to find the maximum element in each column 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 column and print it.


Program to find the maximum element in each column 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
7
8
9


Minimum element in each column 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

4

1


Algorithm to find the minimum element in each column 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 column and print it.


Program to find the minimum element in each column 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
2
3


Recommended Programs







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