MIT-Curricular/OOP/Java/Lab/Week2/Ternary.java

23 lines
555 B
Java

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);
}
}