Advertisement
Guest User

Untitled

a guest
Apr 6th, 2020
243
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.65 KB | None | 0 0
  1. import java.util.*;
  2. public class Homemeworke
  3. {
  4.    
  5.         public static void main (String[] bruh)
  6.         {  
  7.            
  8.             System.out.print("How many numbers: ");
  9.             int num = IO.readInt();
  10.     double array[] = new double[num];
  11.     for (int j = 0; j < num; j++) {
  12.         System.out.printf("Please enter double %d:%n", j + 1);
  13.         array[j] = IO.readDouble();
  14.    
  15.     System.out.println("unsorted array: " + Arrays.toString(array));
  16.     Arrays.sort(array); // <-- or however you want to sort the array.
  17.     System.out.println("sorted array: " + Arrays.toString(array));
  18.     }
  19.        
  20.    
  21.  
  22. }
  23. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement