fork(1) 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. public static void main (String[] args) throws java.lang.Exception
  11. {
  12. Scanner scanIn = new Scanner(System.in);
  13. double a, b, P, Q;
  14.  
  15. a = scanIn.nextDouble();
  16. b = scanIn.nextDouble();
  17.  
  18. P = (a + b) / 2;
  19. Q = Math.sqrt(a * b);
  20.  
  21. System.out.println("(a + b) / 2 = " + P + "!");
  22. System.out.println("Math.sqrt(a * b) = " + Q + "!");
  23. }
  24. }
Success #stdin #stdout 0.08s 4386816KB
stdin
4
6
stdout
(a + b) / 2 = 5.0!
Math.sqrt(a * b) = 4.898979485566356!