1.

without using if-else statement and ternary operators, accept three unequal numbers and display the second smallest number In java

Answer»

Class SECOND
{
public static void main(String args[])
{
Scanner in= NEW Scanner(System.in);
System.out.println("Enter three unequal NUMBERS");
int a= in.nextInt();
int b=in.nextInt();
int c=in.nextInt();
int sec= Math.max(Math.min(a,b),Math.min(Math.max(a,b),c);
System.out.println("The second SMALLEST number is" + sec);
}
}



Discussion

No Comment Found