Easy Acceptance

Description:

A very easy challenge. Write a program which accepts 3 integers and sort them in ascending order. For ex : 1) if user input 39 26 28 then output will be 26 28 39. 2) if user input 3934 2426 4628 then output will be 2426 3934 4628. Test Case 1 Input (stdin) 39 26 28 Expected Output 26 28 39 Test Case 2 Input (stdin) 3934 2426 4628 Expected Output 2426 3934 4628

Program :

#include <iostream>

using namespace std;

int main ()

{

    int a,b,c;

    //cout<<"Enter three integers :";

    cin>>a>>b>>c;

//cout<<endl;

    if (a>b && b>c) {

    cout<<c<<" "<<b<<" "<<a;

    }

    else if (a>c && c>b)

    cout<<b<<" "<<c<<" "<<a;

    else if (b>a && a>c)

    cout<<c<<" "<<a<<" "<<b;

    else if (b>c && c>a)

    cout<<a<<" "<<c<<" "<<b;

    else if (c>a && a>b)

    cout<<b<<" "<<a<<" "<<c;

    else cout<<a<<" "<<b<<" "<<c;

//cout<<endl;

}