Computer Science, asked by Aaronsaha2, 1 year ago

without using if else and ternary operators,accept three unequal no. and display the second smallest no. use Math.max,math.min. input.34,82,61

Answers

Answered by adityamenon10
1
public class three_sort{ public static void main(String[] args) { int a = Integer.parseInt( args[0] ); int b = Integer.parseInt( args[1] ); int c = Integer.parseInt( args[2] ); int min = a; (min > b) && (min = b); //finding minimum (min > c) && (min = c); System.out.println(min); int i = a; (b < max) && (b > min) && (i = b); // finding intermediate (c < max) && (c > min) && (i = c); System.out.println(i); int max = a; (max < b) && (max = b); //finding maximum (max < c) && (max = c); System.out.println(max); } }
Similar questions