Computer Science, asked by priyansh9999, 10 months ago

write a java program to enter three numbers and print the largest number without using if else if ladder ​

Answers

Answered by ken7296
3

Answer:

import java.util.Scanner;

class K

{

public static void main

{

Scanner sc=new Scanner (System.in);

System.out.println("Enter 3 numbers");

int a=sc.nextInt();

int b=sc.nextInt();

int c=sc.nextInt();

String d;

d=a>b?("a is greatest":"b is greatest"):("b is greatest":"c is greatest");

System.out.println("Result = "+d);

}

}

Similar questions