Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import java.util.*;
- class Ascending2 {
- public static void main(String[] args) {
- Scanner src=new Scanner(System.in);
- int n;
- System.out.println("Enter the size of the Array");
- n=src.nextInt();
- int arr[]=new int[n];
- for(int i=0;i<n;i++)
- {
- System.out.println("Enter the element");
- arr[i]=src.nextInt();
- }
- Arrays.sort(arr);
- System.out.println("The elements in ascending order are");
- for(int j=0;j<n;j++)
- {
- System.out.println(arr[j]);
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement