fork(2) download
  1. /* package whatever; // don't place package name! */
  2.  
  3. import java.util.Scanner;
  4. import java.io.*;
  5.  
  6. /* Name of the class has to be "Main" only if the class is public. */
  7. class Convert
  8. {
  9. public static void main (String[] args) throws java.lang.Exception
  10. {
  11. Scanner reader = new Scanner(System.in);
  12. double fahrenheit;
  13. double celsius;
  14.  
  15. System.out.print("Enter degrees Fahrenheit: ");
  16. fahrenheit = reader.nextDouble();
  17.  
  18. celsius = (fahrenheit - 32.0) * 5.0 /9.0;
  19. System.out.println("Fahrenheit entered is " + fahrenheit);
  20. System.out.print("The equivalent in Celsiusis ");
  21. System.out.println(celsius);
  22. // your code goes here
  23. }
  24. }
Success #stdin #stdout 0.07s 4386816KB
stdin
1
stdout
Enter degrees Fahrenheit: Fahrenheit entered is 1.0
The equivalent in Celsiusis -17.22222222222222