java实现斐波那契数列升序排列
import java.util.Scanner;
public class Yxcf {
public static void main(String[] args) {
System.out.println("请输入要排序的个数:");
Scanner input = new Scanner(System.in);
int n = input.nextInt();
int [] mao = new int[n];
System.out.println("请输入要排序的数:");
for (int i = 0; i < n; i++) {
mao[i] = input.nextInt();
}
for(int j=0;j <= n-1;j++){
for (int i=0;i < n-1;i++) {
if(mao [i] > mao [i+1]) {
int t = mao[i];
mao[i] = mao[i+1];
mao[i+1] = t;
}
}
}
System.out.print("排序结果为:");
for (int j = 0; j < n; j++) {
System.out.print(mao[j]+" ");
}
}
}