Convert Celsius into Fahrenheit Program in Java

In this tutorial, We are going to learn a python program to convert Celsius into Fahrenheit. This program will be simple because we will use just a given formula of Celsius to Fahrenheit conversion. We have to Just apply this conversion formula in java programming.

How our Program will behave?

• Java program will take a temperature value from user in Celsius as a input.
• We will apply Celsius to Fahrenheit conversion formula which is (Celsius * 9 / 5)+32.
• This calculation result will be temperature in Fahrenheit.

Program : Convert Celsius into Fahrenheit

import java.util.*;
public class Main
{
    public static void main(String[] args) {
        float celsius, fahrenheit;
        System.out.println("Program to convert Celsius to Fahrenheit" );
        Scanner sc = new Scanner(System.in);
        System.out.println("Please give the Celsius Temperature");
        celsius= sc.nextFloat();
        fahrenheit = (celsius * 9 / 5) + 32;
        System.out.printf("Fahrenheit = %.2f",fahrenheit);
    }
}

Output

Program to convert Celsius to Fahrenheit
Please give the Celsius Temperature
36
Fahrenheit = 96.80

Explanation

For the input Celsius temperature 37.

Fahrenheit temperature = (37 *9/5) + 32 = 98.60.

I hope above Celsius to Fahrenheit Java program is clear to you.

Happy Coding!!