import java.util.*;
public class Prog{
public static void main(String... args){
Scanner in = new Scanner(System.in);
int a,b,c,d,e;
System.out.print("Enter 1st num: ");
a = in.nextInt();
System.out.print("Enter 2nd num: ");
while((b=in.nextInt())==a){
System.out.print("Duplicate.. Try again : ");
}
System.out.print("Enter 3rd num: ");
while((c=in.nextInt())==b || c ==a){
System.out.print("Duplicate.. Try again : ");
}
d = Math.min(a,b);
e = Math.max(d,c);
System.out.println(+e);
}
}
Saturday, August 5, 2017
Find the second smallest number among three
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment