Preview:
class Solution
{
  //Function to find median of the array elements.  
  public int median(int A[],int N)
    {
      
        Arrays.sort(A);
        int k=N/2;
        if(N%2!=0){
            return A[k];
        }
        else{
            return (A[k-1]+A[k])/2;
        }
    }
    //Function to find median of the array elements.
    public int mean(int A[],int N)
    {
        int sum=0;
        for(int i=0;i<N;i++)
        {
            sum=sum+A[i];
        }
        return sum/N;
    }

}
downloadDownload PNG downloadDownload JPEG downloadDownload SVG

Tip: You can change the style, width & colours of the snippet with the inspect tool before clicking Download!

Click to optimize width for Twitter