diff --git a/Java/Bubblesort.java b/Java/Bubblesort.java new file mode 100644 index 0000000..3b23c8d --- /dev/null +++ b/Java/Bubblesort.java @@ -0,0 +1,32 @@ +public class Bubblesort +{ + public static void main(String[] args) + { + int n = 10, i, j, x; + int[] array = new int[n]; + Scanner s = new Scanner(System.in); + + System.out.print("Enter no. of elements in random order:"); + for(i=0; iarray[j+1]) + { + x = array[j]; + array[j] = array[j+1]; + array[j+1] = x; + } + } + } + + System.out.println("\nThe new sorted array is:"); + for(i=0; i