Computer Science, asked by subadibhoomi, 5 months ago

Write a program to enter two numbers and print the greatest integer using the ternary operator ? The answer should be in Java language

Answers

Answered by CopyThat
2

Program: {JAVA}

import java.util.*;

public class Brainly

{

static void main()

{

Scanner sc=new Scanner(System.in);

int a,b;

System.out.print("Enter 2 integers: ");

a=sc.nextInt();

b=sc.nextInt();

System.out.println((a>b)?"Largest="+a:(b>a)?"Largest="+b:"Equal");

}

}

Similar questions