bugl
bugl
HomeLearnPatternsPathsSearchPremium
HomeLearnPatternsPaths

Loading lesson path

Learn/Java/Java How To's
Java•Java How To's

Java How To - Convert Celsius to Fahrenheit

Convert Celsius to Fahrenheit

Use the formula F = C * 9/5 + 32 to convert temperatures:

Example

double celsius = 23.5;
double fahrenheit = celsius * 9 / 5 + 32;
System.out.println(celsius + "C = " + fahrenheit + "F");

Explanation: We apply the standard conversion formula. Multiplying by 9/5 and adding 32 converts Celsius into Fahrenheit.

Previous

Java How To Get the Area of a Rectangle

Next

Java How To - Sum of Digits