Live Batches
Masterclasses
Menu
Free Courses
Account
Login / Sign Up

Sort Three Numbers Using Conditional Statements

Acceptance 90.15% Points 10.00

You are given three integers. Using only conditional statements and without using any built-in sorting function, your task is to return the three values in ascending order.

Examples
Example 1

image Input: a = 3, b = 1, c = 2
Output: 1 2 3
Explanation: The values are arranged from smallest to largest.

Example 2

image Input: a = 5, b = 5, c = 2
Output: 2 5 5
Explanation: Duplicate values are placed adjacently in sorted order.

Example 3

image Input: a = 9, b = 7, c = 8
Output: 7 8 9
Explanation: The three values are sorted in ascending order.

Constraints
    • -10? = each number = 10?
Companies
Expedia Coinbase
Topics
Comparisons
Solution.cs C#JavaPythonC++Javascript

Unlock the code editor

Sign in to write, run, and submit your solution against the full test suite.

  • Run code against sample & hidden test cases
  • Save submissions and track your streak
  • Compare with editorial & community solutions