Computer Science, asked by SaiPradyumnan4575, 8 months ago

Write a program to find the greatest and smallest of any three numbers using ternary operator. Please answer this question

Answers

Answered by aseemalatheef
0

Answer:

import java.util.*;

class Main{

public static void main(String args[]){

Scanner sc = new Scanner(System.in);

int a = sc.nextInt(); int b = sc.nextInt(); int c = sc.nextInt();

int res = a>b>c ? a:b:c;

int res1 = a<b<c? c:b:a;

System.out.println(res);

System.out.println(res1);

sc.close();

}}

Explanation:

The answer is given above and i have implemented in java .

Similar questions