2696 - 三个整数的排序
【问题描述】编写一个程序,输入三个整数,按从大到小的顺序打印出来
<br />
Input
输入三个整数(integer)。
Output
按从大到小输出整数。
Examples
Input
89 63 96
Output
96 89 63
Solution C++
#include <iostream> #include <cstdio> using namespace std; int main() { int a,b,c,t; cin>>a>>b>>c; if(a<b)//确保a>=b { t=a;a=b;b=t; } if(a<c)//确保a>=c { t=a;a=c;c=t; } if(b<c)//确保b>=c { t=b;b=c;c=t; } printf("%d %d %d\n",a,b,c); return 0; }