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
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
Social Sciences,
2 months ago
Computer Science,
2 months ago
English,
5 months ago
Science,
10 months ago