write a program to input three integer. Find
the second swallet number (scanner).
Answers
Answered by
9
Explanation:
import java.util.*;
{
public static void main(String args[])
{
Scanner sc=new Scanner(System.in());
int a,b,c;
System.out.println("enter 3 numbers");
a=sc.nextInt();
b=sc.nextInt();
c=sc.nextInt();
max=(a>b && a>c) ? a:(b>c?b:c);
min=(a<b && a<c) ? a:(b<c?b:c);
System.out.println("the second smallest number is "+(a+b+c-min-max));
}
}
Similar questions