In this article, we will show you how to write a Java program to convert Celsius to Fahrenheit with an example. And the formula to convert the Fahrenheit = (1.8 * Celsius) + 32.
The below Java code allows the user to enter the temperature in Celsius. Next, it uses the above formula and converts C to Fahrenheit F.
package Remaining;
import java.util.Scanner;
public class CelsiusToFahrenheit {
private static Scanner sc;
public static void main(String[] args) {
sc= new Scanner(System.in);
System.out.print("Enter the Temperature in Celsius = ");
double celsius = sc.nextDouble();
double fahrenheit = ((celsius * 9) / 5) + 32;
//double fahrenheit = (1.8 * celsius) + 32;
System.out.println("Temperature in Celsius = " + celsius);
System.out.println("Temperature in Fahrenheit = " + fahrenheit);
}
}

Let me try different values in the above program.
Enter the Temperature in Celsius = 36
Temperature in Celsius = 36.0
Temperature in Fahrenheit = 96.8