fork download
  1. /* My Java program */
  2. import java.util.*;
  3. import java.lang.*;
  4. import java.io.*;
  5.  
  6. class MyLab03
  7. {
  8. public static void main (String[] args) throws java.lang.Exception
  9. {
  10. double x = 0.0;
  11. double z = 0.0;
  12. System.out.println("Please enter value for X\n");
  13. Scanner in = new Scanner(System.in);
  14. x = in.nextDouble();
  15. System.out.println(x);
  16. in.close();
  17. z = Math.sqrt(x) - (x / (x + 1)) + (0.2 * x);
  18.  
  19. System.out.println ("Final result is z=" + z);
  20. }
  21. }
Success #stdin #stdout 0.2s 60916KB
stdin
145
stdout
Please enter value for X

145.0
Final result is z=40.04844389386079