Skip to content

Largest of Three

Determine the greatest among three numbers.

package DSA.Conditional_statements;
import java.util.Scanner;
public class largestof3 {
public static void main(String[]args){
try(Scanner sc = new Scanner(System.in)){
int a = sc.nextInt();
int b = sc.nextInt();
int c = sc.nextInt();
if(a>=b && a>=c){
System.out.println("a is the largest");
}
else if(b>=a && b>=c){
System.out.println("b is the largest");
}
else{
System.out.println("c is the largest");
}
}
}
}