Here we learn the Java program to convert Fahrenheit (°F) Temperature into Celsius (°C) Temperature.
The login behind to calculate this conversion is
The temperature T in degrees Celsius (°C) is equal to the temperature T in degrees Fahrenheit (°F) minus 32, times 5/9:
T(°C) = (T(°F) - 32) × 5/9
or
T(°C) = (T(°F) - 32) / (9/5)
or
T(°C) = (T(°F) - 32) / 1.8
0 degrees Fahrenheit is equal to -17.77778 degrees Celsius.
Example :
Convert 68 degrees Fahrenheit to degrees Celsius:
T(°C) = (68°F - 32) × 5/9 = 20 °C
1 2 3 4 5 6 7 8 9 10 11 12 13 | public class FahrenheitToCelsius { public static void main(String[] args) { System.out.print("Enter Temperature in Fahrenheit : "); Scanner sc = new Scanner(System.in); double fahrenheit = sc.nextDouble(); double celsius = (fahrenheit - 32) / 1.8; System.out.println("\nTemperature in Celsius : "+celsius+" °C"); } } |
Output:
Enter Temperature in Fahrenheit : 68
Temperature in Celsius : 20.0 °C
Blog Author - Pushkar Khosla,
Software Developer by Profession with 3.0 Yrs of Experience , through this blog i'am sharing my industrial Java Knowledge to entire world. For any question or query any one can comment below or mail me at pushkar.itsitm52@gmail.com.
This blog is all about to learn Core Java ,Interview Programs and Coding tricks to polish your Java Knowledge. If you like the content of this blog please share this with your friends.
Software Developer by Profession with 3.0 Yrs of Experience , through this blog i'am sharing my industrial Java Knowledge to entire world. For any question or query any one can comment below or mail me at pushkar.itsitm52@gmail.com.
This blog is all about to learn Core Java ,Interview Programs and Coding tricks to polish your Java Knowledge. If you like the content of this blog please share this with your friends.


No comments:
Post a Comment