Basic exercises to sort columns
Resource constraints
Time limit: 1.0s Memory Limit: 512.0MB
Problem Description
Given a length n, the number of columns, this number of columns arranged in large ascending order. 1 <= n <= 200
Input Format
Conduct a first integer n.
The second line contains n integers, the number to be sorted, each of the integer absolute value of less than 10,000.
Output Format
Output line, in ascending order of the number of output columns sorted.
Sample input
5
8 3 6 4 9
Sample Output
3 4 6 8 9
import java.util.Arrays;
import java.util.Scanner;
public class Main {
public static void main(String[] args) {
Scanner scanner=new Scanner(System.in);
int n=scanner.nextInt();
int[] array=new int[n];
for(int i=0;i<array.length;i++){
int m=scanner.nextInt();
array[i]=m;
}
Arrays.sort(array);
for(int i=0;i<array.length;i++){
System.out.print(array[i]+" ");
}
}
}