# Java Program to Convert Celsius to Fahrenheit

• Java program to convert temperature from Celsius to Fahrenheit.
• Write a java program to convert temperature from Celsius to Fahrenheit.

In this java program, we have to convert celsius temperature to fahrenheit temperature scale. We will first take a celsius temperature as input from user and then convert it to fahrenheit temperature and print it on screen.

For Example,
40 Celsius is equal to 104 Fahrenheit
• Celsius is a temperature scale where 0 °C indicates the melting point of ice and 100 °C indicates the steam point of water.
• Fahrenheit temperature scale was introduced around 300 years ago and is currently used in US. The boiling point of water is 212 °F and the freezing point of water is 32 °F.

Given a temperature in celsius, we can convert to fahrenheit scale using following equation.

F =(9/5)*C + 32

where, C is the temperature in Celsius and F is temperature in Fahrenheit.

## Java program to convert celsius to fahrenheit temperature

``` package com.tcc.java.programs;

import java.util.Scanner;

/**
* Java Program to convert temperature from
* Celsius to Fahrenheit
*/
public class CelsiusToFahrenheit {
public static void main(String args[]) {
double celsius, fahren;
Scanner scanner;
scanner = new Scanner(System.in);
// Take temperature in Celsius as input from user
System.out.println("Enter Temperature in Celsius");
celsius = scanner.nextFloat();

fahren = (9.0 / 5.0) * celsius + 32;

System.out.print("Temperature in Fahrenheit = " + fahren);
}
}
```
Output
```Enter Temperature in Celsius
100
Temperature in Fahrenheit = 212.0
```
```Enter Temperature in Celsius
0
Temperature in Fahrenheit = 32.0
```

Recommended Posts
 Java Program to Convert Fahrenheit to Celsius Java Program to Convert Decimal to Binary Numbers Java program to convert binary number to decimal number Java Program to Convert Octal Number to Decimal Number Java Program to Calculate Volume of Sphere Java Program to Calculate Compound Interest Java Program to Calculate Simple Interest Java Program to Make a Simple Calculator using Switch Statement Java Program to Find Sum of Digits of a Number Java Program for Matrix Multiplication Java Program to Find All Factors of a Number All Java Programs
 Previous Next