-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathlarmat.java
More file actions
32 lines (32 loc) · 817 Bytes
/
larmat.java
File metadata and controls
32 lines (32 loc) · 817 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
import java.util.*;
class larmat
{
public static void main(String[] args) {
int i,j,m,n,large;
Scanner sc=new Scanner(System.in);
System.out.println("enter no of rows and coloums");
m=sc.nextInt();
n=sc.nextInt();
int a[][]=new int[m][n];
System.out.println("enter elements");
for(i=0;i<m;i++)
{
for(j=0;j<n;j++)
{
a[i][j]=sc.nextInt();
}
}
large=a[0][0];
for(i=0;i<m;i++)
{
for(j=0;j<n;j++)
{
if(a[i][j]>large)
{
large=a[i][j];
}
}
}
System.out.println("largest element in the "+m+"*"+n+" matrix is "+large);
}
}