如果我的输入是 1 2 3,输出也是 1 2 3,我如何让这些数字显示 3 2 1?
public static void main(String[] args) {
// TODO code application logic here
Scanner s = new Scanner(System.in);
String text = s.nextLine();
String[] entries = text.split(" ");
int[] nums = new int[entries.length];
for(int i = 0; i < entries.length; i++){
nums[i] = Integer.parseInt(entries[i]);
}
for(int i = 0; i < entries.length; i++){
System.out.println(nums[i]);
}
}
}
红糖糍粑
ABOUTYOU
翻过高山走不出你
列表数据获取问题
输入两行数,第一行为n,表示需要排序的数的个数。第二行表示需要排列的数。使他们从大到小排列并输出
输入两行数
第一行为n
FFIVE
相关分类