- Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathArrayGreatestof3.java
More file actions
Latest commit
29 lines (27 loc) · 645 Bytes
/
Copy pathArrayGreatestof3.java
File metadata and controls
29 lines (27 loc) · 645 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
/**
*
* @author Mudassar
*/
importjava.util.Scanner;
publicclassArrayGreatestof3 {
publicstaticvoidmain(String[] args) {
inta[]=newint[3];
Scannersc=newScanner(System.in);
System.out.println("Enter three numbers:");
for(inti=0;i<=2;i++)
{
a[i]=sc.nextInt();
}
if (a[0]>a[1] && a[0]>a[2])
{
System.out.println(a[0]+"is greatest");
}
elseif (a[1]>a[0] && a[1]>a[2])
{
System.out.println(a[1]+"is greatest");
}
else {
System.out.println(a[2]+"is greatest");
}
}
}