Run Code
|
API
|
Code Wall
|
Misc
|
Feedback
|
Login
|
Theme
|
Privacy
|
Patreon
doubt
//'main' method must be in a class 'Rextester'. //openjdk version '11.0.5' import java.util.*; import java.lang.*; class Rextester { public static void main(String args[]) { Scanner sc=new Scanner(System.in); int a[]=new int[5]; int b[]=new int[5]; int i,j,c=0,k=2,h=0,f=0,t; for(i=0; i<5; i++) a[i]=sc.nextInt(); for(i=0; i<5; i++) { for(j=0; j<5; j++) { if(a[0]<a[j]) { h=a[j]; f=j; } } if(a[f]>a[i]) { t=a[i]; a[i]=a[f]; a[f]=t; } c++; b[k]=h; if(c%2!=0) k=k-(i+1); else k=k+(i+1); } for(i=0; i<5; i++) System.out.print(b[i]+" "); } }
run
|
edit
|
history
|
help
0
updated
Frequency
4c
default constructor
// Java Coding Challenge - 06: Print out Fibonacci numbers 0 - 93
Partition Palindrome (BackTracking) #131
Inheritance
LRU cache - Using doubly linked list (Fast!)
dimond of stars
Nick-test