How can i make the 2d array comparation in colomns? Help plz its for my School project and i have tried so many time but..

I have created a 2d array so lets say as i did in the code below the array elements shows like this 3 4 8 2 I want to compare the" ROWS" and get the minimum number like what i do with 3&4 i get 3 is the min number and with the second row between 8&2 i get 2 is the min number My problem is that i can't get it to compare the colomns as in 3&8 to get the max out between them And 4&2 In the code it just outputs the max number in the rows it still comparing the "ROWS" P. S sorry for the long explation i just had to clearfiy it https://code.sololearn.com/cXLY7XxCD52t/?ref=app https://code.sololearn.com/cXLY7XxCD52t/?ref=apy

10/4/2019 10:38:36 PM


3 Answers

New Answer


For max change max = arr[i][0] to max = arr[0][i] and arr[i][j] to arr[j][i]


It is nearly the same code. Just exchange i and j when accessing any values in the matrix.


Omg it worked!!!! Thank you guys soo Much