Max of 3 numbers X54662


Statement
 

pdf   zip

Poker poker.

Write a program that receives 3 ints, and outputs the median. The median of 3 ints is here defined as follows: if two (or more) of the ints are equal, then the median is equal to their value; otherwise, the median is the unique int of the three such that one is greater than it and one is less than it.

Input

3 ints.

Output

The median of the 3 input ints.

Observation

You may flesh out the following code:

import java.io.*;
import java.util.*;

class Main {

    public static int median( int a, int b, int c )
    {
        // FILL THIS OUT
        return 0;
    }

    public static void main (String[] args) {
        Scanner in = new Scanner(System.in);
        int a = in.nextInt();
        int b = in.nextInt();
        int c = in.nextInt();

        System.out.println( median( a, b, c ));
    }

}
Public test cases
  • Input

    1 
    1 1 2 1 3 1 4 1 5 1
    
    
    

    Output

    Printing hand...
    1 1 2 1 3 1 4 1 5 1 
    Done
    Straight flush
    
  • Information
    Author
    Hubie Chen
    Language
    English
    Official solutions
    Java
    User solutions