forked from VimalKrishnaRao/OOP-in-Java-Lab
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathLarmat.java
More file actions
21 lines (21 loc) · 682 Bytes
/
Copy pathLarmat.java
File metadata and controls
21 lines (21 loc) · 682 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
import java.util.Scanner;
class Larmat
{
public static void main (String args[])
{
Scanner sc = new Scanner (System.in);
System.out.println ("Enter the Matrix Size: ");
int n = sc.nextInt();
int a[][]=new int [n][n];
System.out.println ("Enter an "+n+"X"+n+" Matrix:");
for (int i=0; i<n; i++)
for (int j=0; j<n; j++)
a[i][j]=sc.nextInt();
int lar = a[0][0];
for (int i=0; i<n; i++)
for (int j=0; j<n; j++)
if (lar<a[i][j])
lar = a[i][j];
System.out.println ("The Largest Element in the Matrix is: "+lar);
}
}