You are viewing a single comment's thread. Return to all comments →
import java.math.BigDecimal; import java.util.*; class Solution{ public static void main(String []args){ //Input Scanner sc= new Scanner(System.in); int n=sc.nextInt(); String []s=new String[n+2]; for(int i=0;i
//Write your code here try { BigDecimal A,B; int i = 0; String temp; while(i < n){ for(int j = 0; j < n-1; j++){ A = new BigDecimal(s[j]); B = new BigDecimal(s[j+1]); if(A.compareTo(B) < 0){ temp = s[j]; s[j] = s[j+1]; s[j+1] = temp;
// System.out.println(s[j]); } } i++; }
}catch (NullPointerException | NumberFormatException e){ System.out.println(e); } //Output for(int i=0;i<n;i++) { System.out.println(s[i]); } }
}
Seems like cookies are disabled on this browser, please enable them to open this website
Java BigDecimal
You are viewing a single comment's thread. Return to all comments →
import java.math.BigDecimal; import java.util.*; class Solution{ public static void main(String []args){ //Input Scanner sc= new Scanner(System.in); int n=sc.nextInt(); String []s=new String[n+2]; for(int i=0;i
// System.out.println(s[j]); } } i++; }
}