-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathlarnxn.java
More file actions
32 lines (29 loc) · 756 Bytes
/
larnxn.java
File metadata and controls
32 lines (29 loc) · 756 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 larnxn
{
public static void main(String args[])
{
Scanner obj = new Scanner(System.in);
System.out.println("how many row");
int r = obj.nextInt();
System.out.println("how many coln");
int c = obj.nextInt();
int a[][] = new int[10][10];
System.out.println("enter the elements into the array");
for(int i=0;i<r;i++)
for(int j=0;j<c;j++)
a[i][j] = obj.nextInt();
for(int i=0;i<r;i++)
{
System.out.println();
for(int j=0;j<c;j++)
System.out.print(a[i][j]+" ");
}
int l=0;
for(int i=0;i<r;i++)
for(int j=0;j<c;j++)
if(a[i][i]>l)
l= a[i][j];
System.out.println("the largest element is "+l);
}
}