package demos; import java.util.Scanner; public class SelectionSort { public static void main(String[] args) { // TODO Auto-generated method stub Scanner sc=new Scanner(System.in);//user input using scanner System.out.println("Enter the size of the array");//taking size of the array from user int size=sc.nextInt(); int array[]=new int[size];//declaring array of n elements to be sorted System.out.println("Enter"+ size + "elements to sort"); for(int i=0;iarray[j])//if i'th element of array is greater than j'th element swap the elements { int temp=array[i]; array[i]=array[j]; array[j]=temp; } } } System.out.println("Array after sorting"); for(int i=0;i