HomePOSTJava Program to Convert Celsius to Fahrenheit (updated)

Java Program to Convert Celsius to Fahrenheit (updated)

Java Program to Convert Celsius to Fahrenheit (updated) – Conversion from Celsius to Fahrenheit and from Fahrenheit to Celsius has an important role in the conversion of units system. In this post, we will develop a Java program to convert Celsius to Fahrenheit.

The formula used to convert from Celsius to Fahrenheit is given as,

⁰F= (⁰C * 9/5) + 32

<img width=

Java Program to Convert Celsius to Fahrenheit

import java.util.Scanner;

public class TemperatureConversion {
  // method to convert celsius to fahrenheit
  private static double tofahrenheit(double celsius){
     return ( celsius * (9.0/5.0) + 32 );

  public static void main(String[] args) {

     // declare variables
     double celsius = 0.0;
     double fahrenheit = 0.0;

     // create Scanner class object to read input
     Scanner scan = new Scanner(System.in);

     // read input
     System.out.print("Enter Celsius value:: ");
     celsius = scan.nextDouble();

     // convert temperature
     fahrenheit = tofahrenheit(celsius);

     // display result
     System.out.println("Fahrenheit value = "

     // close Scanner class object
The output for different test-cases:-


Enter Celsius value:: 15
Fahrenheit value = 59.0

Types of Sorting Algorithms:

Additional Reading


If you found this post useful, don’t forget to share this with your friends, and if you have any query feel free to comment it in the comment section.

Thank you 😊 Keep Learning !



Please enter your comment!
Please enter your name here

- Advertisment -

Most Popular

- Advertisment -