I have figured that i have a problem in method "srodek" - it should show middle one
Minimum and maksimum are working corectly .They are using return not print
System.out.print(maksimum(a, b, c)+" ");
srodek(a,b,c);
System.out.print( minimum(a, b, c));
I was happy thats my middle was corect.
But it had problem with same numbers
ex. 1 2 1 was printing 2 1 1 1
I solved task by changing print to retun
public static void srodek(int a, int b, int c) {
if ((a <= b && a >= c) || (a >= b && a <= c)) {
mid = a;
System.out.print(a + " ");
}
if ((b <= a && b >= c) || (b >= a && b <= c)) {
mid = b;
System.out.print(b + " ");
}
if ((c <= a && c >= b) || (c >= a && c <= b)) {
mid = c;
System.out.print(c + " ");
}
}
Could anyone explain me why it duplicate a number(prints 4 numbers not 3) while there's a couple of same numbers? (11 11 2) as (11 11 11 2 )