How can I print the maximum element of the columns of the matrix? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

How can I print the maximum element of the columns of the matrix?

I can print the maximun element of the rows, but I can´t do it with the columns. https://code.sololearn.com/cNjV4pKqAKPM/?ref=app

2nd Jun 2020, 1:08 AM
Jessica
Jessica - avatar
4 Answers
+ 2
You're very welcome
2nd Jun 2020, 4:02 AM
Ipang
0
Let me see your code? You know how to share code link here? in case not, follow this guide 👇 https://www.sololearn.com/post/75089/?ref=app
2nd Jun 2020, 1:10 AM
Ipang
0
Jessica Here is a modified `numMax` method that seeks for maximum value by rows. public void numMax (int filas, int columnas, int matriz [][]) { for (int i = 0, mayor; i < columnas ; i++) { mayor = 0; for (int j = 0; j < filas ; j++) { if (matriz[j][i] > mayor) { mayor = matriz[j][i]; } } System.out.println(mayor); } }
2nd Jun 2020, 2:35 AM
Ipang
0
Thank you very much.
2nd Jun 2020, 3:50 AM
Jessica
Jessica - avatar