Here we learn the java program to convert Celsius (°C) Temperature into Fahrenheit (°F) Temperature.
The login behind to calculate this conversion is
The temperature T in degrees Fahrenheit (°F) is equal to the temperature T in degrees Celsius (°C) times 9/5 plus 32:
T(°F) = T(°C) × 9/5 + 32
or
T(°F) = T(°C) × 1.8 + 32
Example :
Convert 35 degrees Celsius to degrees Fahrenheit:
T(°F) = 20°C × 9/5 + 32 = 95.0 °F
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 | import java.util.Scanner; public class CelsiusToFahrenheit { public static void main(String[] args) { System.out.print("Enter Temperature in Celsius :\t"); Scanner sc = new Scanner(System.in); int celsius = sc.nextInt(); double fahrenheit = celsius * 1.8 + 32; System.out.println("\nTemperature in Fahrenheit :\t"+fahrenheit+" °F"); } } |
Output:
Enter Temperature in Celsius : 35
Temperature in Fahrenheit : 95.0 °F
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.
Java I/O Tutorial

No comments:
Post a Comment