Browse Source

上传文件至 ''

main
yujingle 1 month ago
parent
commit
ef5cf42904
  1. 10
      TemperatureConverter.java

10
TemperatureConverter.java

@ -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…
Cancel
Save