My Program works on IntelliJ
Any ideas on why it wont pass the server test?
I know I can construct it differently but this should work. I have ran into this problem before.
package com.codegym.task.task04.task0441;
/*
Somehow average
*/
import java.io.BufferedReader;
import java.io.InputStreamReader;
public class Solution {
public static void main(String[] args) throws Exception {
BufferedReader r = new BufferedReader((new InputStreamReader(System.in)));
int m = Integer.parseInt(r.readLine());
int n = Integer.parseInt(r.readLine());
int p = Integer.parseInt(r.readLine());
if(m>n && m<p|| m<n && m>p ){
System.out.print(m); }
else if(n>m && n<p ||n<m && n>p ){
System.out.print(n); }
else if(p>m && p<n || p>m && p<n ){
System.out.print(p);
}
else if (n==p || n==m){
System.out.print(n);
}
else if (p==m || p==n){
System.out.print(p);
}
else{
System.out.print(m);
}
}
}