From 70afdaf852a6676a17582ea008a6b6b7a2358897 Mon Sep 17 00:00:00 2001 From: Umesh Singh <83420185+Umesh-01@users.noreply.github.com> Date: Sat, 1 Oct 2022 21:29:35 +0530 Subject: [PATCH] Create Bubblesort.java --- Java/Bubblesort.java | 32 ++++++++++++++++++++++++++++++++ 1 file changed, 32 insertions(+) create mode 100644 Java/Bubblesort.java 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