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

23 lines
555 B
Java
Raw Normal View History

2024-08-05 01:04:41 +05:30
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);
}
}