diff --git a/Java/Algorithms/Sorting/SelectionSort/selectionsort.java b/Java/Algorithms/Sorting/SelectionSort/selectionsort.java new file mode 100644 index 000000000..b9e79803a --- /dev/null +++ b/Java/Algorithms/Sorting/SelectionSort/selectionsort.java @@ -0,0 +1,43 @@ +package com.kholood; +import java.util.Scanner; + +public class Selectionsort { + + public static void main(String args[]) + { + int size, i, j, temp; + int arr[] = new int[50]; + Scanner scan = new Scanner(System.in); + + System.out.print("Enter Array Size : "); + size = scan.nextInt(); + + System.out.print("Enter Array Elements : "); + for(i=0; i arr[j]) + { + temp = arr[i]; + arr[i] = arr[j]; + arr[j] = temp; + } + } + } + + System.out.print("Now the Array after Sorting is :\n"); + for(i=0; i