Upload files to "OOP/Java/Lab/Week2"
This commit is contained in:
parent
730413c501
commit
40f695b27c
5 changed files with 129 additions and 0 deletions
23
OOP/Java/Lab/Week2/Ternary.java
Normal file
23
OOP/Java/Lab/Week2/Ternary.java
Normal file
|
@ -0,0 +1,23 @@
|
|||
import java.util.Scanner;
|
||||
public class Ternary {
|
||||
|
||||
public static void main(String args[]){
|
||||
|
||||
Scanner sc = new Scanner(System.in);
|
||||
|
||||
System.out.println("Enter the first number: ");
|
||||
int a = sc.nextInt();
|
||||
|
||||
System.out.println("Enter the second number: ");
|
||||
int b = sc.nextInt();
|
||||
|
||||
System.out.println("Enter the third number: ");
|
||||
int c = sc.nextInt();
|
||||
|
||||
int largest = (a>b)?((b>c)?a:c):((b>c)?b:c);
|
||||
|
||||
System.out.println("The largest number is: "+largest);
|
||||
|
||||
}
|
||||
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue