Sort Three Numbers
Sort Three Numbers
EasySorting41% accepted
Given three integers, print them in ascending (smallest to largest) order. You cannot use any sorting library. Solve it with comparisons alone. This introduces the idea behind sorting: repeatedly putting smaller elements first.
Approach
Given three integers A, B, C, print them in ascending order separated by spaces.
Input
3 1 2
Output
1 2 3
More Sorting problems
Browse all coding problems →solution.py
Loading editor...
Test 1
Test 2
Test 3
Press Run to test your custom input, or Submit to judge against all test cases.
Sign in to continue
Create a free account to run code, submit solutions and track progress.
- Free forever — no credit card
- 10+ languages with live execution
- Points, streaks & leaderboards