Run Code
|
API
|
Code Wall
|
Misc
|
Feedback
|
Login
|
Theme
|
Privacy
|
Patreon
bubble sort
//'main' method must be in a class 'Rextester'. //Compiler version 1.8.0_111 import java.util.Scanner; class Rextester { public static void main(String args[]) { Scanner in=new Scanner(System.in); int a[]=new int [50]; int n=in.nextInt(); for(int i=0;i<n;i++) a[i]=in.nextInt(); for(int j=0;j<n;j++) { for(int k=0;k<n-j-1;k++) { if(a[k]>a[k+1]){ int temp=a[k]; a[k]=a[k+1]; a[k+1]=temp;} } } for(int l=0;l<n;l++) { System.out.println(a[l]); } } }
run
|
edit
|
history
|
help
0
Ridhiverma
call function
Find if a String2 is substring of String1
Job and Trait Generator
Fibonacci
ElaineBrown**
Search substring
Le saviez-vous ?
Sort an array of 0's 1's 2's
3e