24. Sort Three Numbers
Core1000 ms256 MBSolved by 0%
Read three integers and print them in ascending order on one line, separated by single spaces.
Do this with comparisons only — the point of the exercise is to reason about ordering directly, not to call a sort function.
Constraints - `-1000000 ≤ a, b, c ≤ 1000000`
Input
A single line containing three integers, separated by spaces.
Output
Print the three integers in ascending order on one line, separated by single spaces.
Input3 1 2
Output1 2 3
Noteneeds all three values moved
Input1 2 3
Output1 2 3
Noteis already sorted and must be left alone
Hint 1Approach
Hint 2Approach
Hint 3Pseudocode
Hint 4Full solution