//Sorting the Array
import java.io.*;
import java.util.*;
class DemoArray
{
public static void main(String aa[])throws Exception
{
int arr[]=new int[10];
DataInputStream dis=new DataInputStream(System.in);
System.out.println("Enter 10 elements in Array..");
for(int i=0;i<10;i++)
{
arr[i]=Integer.parseInt(dis.readLine());
}
System.out.println("Entered 10 elements in Array ....");
for(int i=0;i<10;i++)
{
System.out.print(" "+arr[i]);
}
Arrays.sort(arr);
System.out.println("");
System.out.println("Sorted 10 elements in Array ....");
for(int i=0;i<10;i++)
{
System.out.print(" "+arr[i]);
}
}
}
No comments:
Post a Comment