Receive 3 numbers and display them in ascending order from smallest to largest
#include <iostream>
#include <algorithm>
using namespace std;
int main() {
int a = 0;
int b = 0;
int c = 0;
cin >> a >> b >> c;
if (a > b)
swap(a, b);
if (b > c)
swap(b , c);
if (a > b)
swap(a ,b);
cout << a << ' ' << b << ' ' << c << endl;
return 0;
}
Comments
Leave a comment