472,518 views
41 votes
41 votes
Convert Fahrenheit to Celsius using this formula: F = (9/5)*C+32

getFahrenheit(30) → 86.0
getFahrenheit(0) → 32.0
getFahrenheit(20) → 68.0

User Calanus
by
3.2k points

1 Answer

16 votes
16 votes

Answer:

The program is written in Java.

public class NewClass {

public static double getFahrenheit(double celcius)

{

double fahrenheit;

fahrenheit=32+(celcius*1.8);

return fahrenheit;

}

public static void main(String [] args) {

System.out.println(getFahrenheit(30));

System.out.println(getFahrenheit(0));

System.out.println(getFahrenheit(20));

}

}

Convert Fahrenheit to Celsius using this formula: F = (9/5)*C+32 getFahrenheit(30) → 86.0 getFahrenheit-example-1
User VinPro
by
2.6k points