佛曰这是冒泡

package Z4;

import java.util.Scanner;

public class ShuZu {
public static void main (String[]args){
Scanner input= new Scanner(System.in);
int i[]=new int[3];
for(int i1=0;i1<i.length;i1++){
i[i1]=input.nextInt();
}


for(int q=0;q<i.length-1;q++){
for(int w=q+1;w<i.length ;w++){
if(i[q]>i[w]){
int zancun=i[w];
i[w]=i[q];
i[q]=zancun;
}
}
System.out.println(i[q]);
}

// System.out.print(i[1]);
System.out.print(i[i.length-1]);






}
}

猜你喜欢

转载自www.cnblogs.com/mj5714/p/9347507.html