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. public static void main (String[] args) throws java.lang.Exception
  11. {
  12. Scanner sc = new Scanner (System.in);
  13. double x = sc. nextDouble();
  14. if (x == 0)
  15. {
  16. double y = 2*x;
  17. System.out.println(y);
  18. }
  19. if (x > 0)
  20. {
  21. double y = 3*x+1;
  22. System.out.println(y);
  23. }
  24. if (x<0)
  25. {
  26. double y = 3*x-1;
  27. System.out.println(y);
  28. }
  29. }
  30. }
Success #stdin #stdout 0.13s 60072KB
stdin
2.3
stdout
7.8999999999999995