1. 程式人生 > >佛曰這是冒泡

佛曰這是冒泡

sta java pub shu ner pri put port oid

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]);






}
}

佛曰這是冒泡