So I did the task and with this code it always would show me the smallest number. The output is 1 | -3 | 3 | 5 and this seems pretty correct to me.
Does anybody know if I did a mistake here, or is it something else?
package de.codegym.task.task02.task0216;
/*
Die kleinste aus drei Zahlen
*/
public class Solution {
public static int min(int a, int b, int c) {
int m;
if (a < b)
m = a;
else if (b < c)
m = b;
else
m = c;
return m;
}
public static void main(String[] args) throws Exception {
System.out.println(min(1, 2, 3));
System.out.println(min(-1, -2, -3));
System.out.println(min(3, 5, 3));
System.out.println(min(5, 5, 10));
}
}