Răspuns :
Răspuns:
#include <iostream>
using namespace std;
int main()
{
int a=1,b=9,c=9;
if(a<=b && b<=c)
{
int temp = c;
c = a;
a = temp;
}
if(b<=a && b<=c)
{
int temp = c;
c = b;
b = temp;
}
if(b>=a && b>=c)
{
int temp = a;
a = b;
b = temp;
}
if(c<=a && c>=b)
{
int temp = b;
b = c;
c = temp;
}
if(c>=a && c>=b)
{
int temp = a;
a = c;
c = temp;
}
cout<<to_string(a) + " " + to_string(b) + " " + to_string(c);
return 0;
}
Explicație:
Sper ca am acoperit cam toate cazurile. Daca mai este ceva puteti sa mai comentati aici!
#include <iostream>
using namespace std;
int main()
{
int a, b, c;
cin >> a >> b >> c;
if(a < b && a < c && b < c)
cout << a << " " << b << " " << c;
else if (a < b && a < c && b > c)
cout << a << " " << c << b;
else if (b < a && b < c && c < a)
cout << b << " " << c << " " << a;
else if (b < a && b < c && c > a)
cout << b << " " << a << " " << c;
else if (c < a && c < b && b < a)
cout << c << " " << b << " " << a;
else if (c < a && c < b && b > a)
cout << c << " " << a << " " << b;
}