fork download
  1. /* package whatever; // don't place package name! */
  2.  
  3. import java.util.*;
  4. import java.lang.*;
  5. import java.io.*;
  6.  
  7. /* Name of the class has to be "Main" only if the class is public. */
  8. class Ideone{
  9.  
  10. static void swap(double a, double b){
  11. if(b > a){
  12. double q = a;
  13. a = b;
  14. b = q;
  15. }
  16. }
  17.  
  18. public static void main (String[] args) {
  19. Scanner in = new Scanner(System.in);
  20. double a = in.nextDouble();
  21. double b = in.nextDouble();
  22. double c = in.nextDouble();
  23. double d = in.nextDouble();
  24. swap(a, b);swap(c, d);
  25.  
  26. System.out.printf("a=%f b=%f\n",a,b);
  27. System.out.printf("c=%f d=%f\n",c,d);
  28. }
  29. }
Success #stdin #stdout 0.15s 321344KB
stdin
10 15
15 10
stdout
a=10.000000 b=15.000000
c=15.000000 d=10.000000