冒泡排序
import java.util.Scanner; public class Main { public static void main(String[] args) { Scanner sc=new Scanner(System.in); int a=sc.nextInt(); int b=sc.nextInt(); int c=sc.nextInt(); sort(a,b,c); } //冒泡排序 static void sort(int a,int b,int c) { int t; if (a>b) { t=a; a=b; b=t; if (b>c) { t=b; b=c; c=t; } }else if(b>c) { t=b; b=c; c=t; } if (a>b) { t=a; a=b; b=t; } System.out.println(a+" "+b+" "+c); } }
0.0分
1 人评分