intMax
Problem:
Given three int values, a b c, return the largest.
Test Cases:
intMax(1, 2, 3) → 3
intMax(1, 3, 2) → 3
intMax(3, 2, 1) → 3
Solution:
public int intMax(int a, int b, int c) {
return (a>b)?((a>c)?a:c):((b>c)?b:c);
}
Problem:
Given three int values, a b c, return the largest.
Test Cases:
intMax(1, 2, 3) → 3
intMax(1, 3, 2) → 3
intMax(3, 2, 1) → 3
Solution:
public int intMax(int a, int b, int c) {
return (a>b)?((a>c)?a:c):((b>c)?b:c);
}