1 changed files with 10 additions and 0 deletions
@ -0,0 +1,10 @@ |
|||
Public class TemperatureConverter { |
|||
public static double |
|||
celsiusToFahrenheit(double celsius) { return celsius * 9.0 / 5.0 + 32; } |
|||
public static double |
|||
fahrenheitToCelsius(double fahrenheit) { return (fahrenheit - 32) * 5.0 / 9.0; } |
|||
public static void main(String[] args) { |
|||
double c = 37.0; |
|||
double f = 98.6; |
|||
System.out.println(c + “ C = “ + celsiusToFahrenheit(c) + “ F”); |
|||
System.out.println(f + “ F = “ + fahrenheitToCelsius(f) + “ C”); }} |
|||
Loading…
Reference in new issue