We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 40d4257 commit 4ba9588Copy full SHA for 4ba9588
BubbleSort.java
@@ -0,0 +1,38 @@
1
+import java.util.Scanner;
2
+
3
+class BubbleSort
4
+{
5
+ public static void main(String[] args)
6
+ {
7
+ int array[]=new int[6];
8
+ Scanner input=new Scanner(System.in);
9
10
+ //Input
11
+ System.out.println("Enter any 6 Numbers for Unsorted Array : ");
12
+ for(int i=0; i<6; i++)
13
14
+ array[i]=input.nextInt();
15
+ }
16
17
+ //Sorting
18
19
20
+ for(int j=0; j<5; j++)
21
22
+ if(array[j]>array[j+1])
23
24
+ int temp=array[j];
25
+ array[j]=array[j+1];
26
+ array[j+1]=temp;
27
28
29
30
31
+ //Output
32
33
34
+ System.out.print(array[i]+"\t");
35
36
37
38
+}
0 commit comments