diff --git a/Java/BubbleSort.java b/Java/BubbleSort.java index befdb3d..8f865ea 100644 --- a/Java/BubbleSort.java +++ b/Java/BubbleSort.java @@ -1,4 +1,5 @@ import java.io.*; +import java.util.Scanner; class BubbleSort { @@ -41,10 +42,14 @@ static void printArray(int arr[], int size) // Driver program public static void main(String args[]) { - int arr[] = { 64, 34, 25, 12, 22, 11, 90 }; - int n = arr.length; + Scanner sc=new Scanner (System.in); + System.out.println("Enter the number of elements to be entered to the array: "); + int n=sc.nsextInt(); + System.out.println("Enter "+n+" elements to be sorted to the array: "); + for(int i=0;i