-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathArra.java
50 lines (48 loc) · 1.13 KB
/
Arra.java
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
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
import java.util.*;
class Lar
{
public static void main(String []args)
{
int big=[0][0];
Scanner n=new Scanner(System.in);
int[][] two=new int[3][3];
System.out.println("Enter the elements in the 2d array: ");
for(int i=0;i<3;i++)
{
for(int j=0;j<3;j++)
{
System.out.print("two[" + i + "][" + j + ": "]);
int two[i][j]=n.nextInt();
}
for(i=0;i<3;i++)
{
for(j=0;j<3;j++)
{
if (two[i][j]>big)
{
big=two[i][j];
}
}
}
System.out.println("The greatest element is : "+big);
}
}
ch[i]=str.charAt(i);
}
System.out.println("Enter the character to be searched: ");
char c=n.next().charAt(0);
for (int i=0;i<ch.length;i++)
{
if(ch[i]==c)
{
System.out.println("The item location is : "+i);
flag=1;
break;
}
}
if(flag==0)
{
System.out.println("Item not found ");
}
}
}