Posts

Showing posts with the label maximum element in each row

Highest Row-wise and Lowest Column-wise Elements in a Matrix in Java

Write a Java program to declare a matrix a[][] of order m × n, where 'm' is the number of rows and 'n' is the number of columns such that m and n are positive integers. Accept the elements i.e. positive integers into this matrix. Now check and display the highest elements row-wise and the lowest elements column-wise. Test the program for the following data and some random data. import java.util.Scanner; class Matrix{     public static void main(String args[]){         Scanner in = new Scanner(System.in);         System.out.print("m = ");         int m = Math.abs(Integer.parseInt(in.nextLine()));         System.out.print("n = ");         int n = Math.abs(Integer.parseInt(in.nextLine()));         int a[][] = new int[m][n];         int i, j;         System.out.println("Enter matrix elements:");         ...