← All problems
Largest of Three Numbers
Easy
3 solved
Largest of Three Numbers
Three integers are given on one line. Print the largest of them.
If two or all three numbers are equal to the largest value, that value is still the answer — print it once.
💡
Compare in pairs. Start by assuming the first number is the biggest, then check the other two against your current best.
Input
A single line with three space-separated integers a, b and c.
Output
A single integer: the largest of the three.
Constraints
-10^9 <= a, b, c <= 10^9
Example 1
Input
3 9 5
Output
9
9 is bigger than both 3 and 5.
Submit runs your code against 5 test cases — the 1 shown above plus 4 hidden ones covering the awkward cases. Run sample just tries the first example, which is usually what you want while you are still working it out.