/**
需求:将变量啊a,b,c中的数值按大小顺序进行排序(从小到大顺序)
@author:CF
@version:1.1
*/
public class IfDemo{
public static void main(String[] args){
A tt = new A();
tt.BiJiao(2,1,6);
}
}
class A{
public void BiJiao(int a, int b, int c){
int temp = 0;
if(a>b){
temp = a;
a = b;
b = temp;
}
if(a>c){
temp = a;
a = c;
c = temp;
}
if(b>c){
temp = b;
b = c;
c = temp;
}
System.out.println("a,b,c数值从小到大排序为+a,b,c");
}
}
} [img]file:///C:\Users\ivan\AppData\Roaming\Tencent\Users\1040113134\QQ\WinTemp\RichOle\(UNB8S[OZ6[F44U`%TC]J1K.png[/img]
|
|