Write a java program to convert temperature from Celsius to Fahrenheit

Write a java program to convert temperature from Celsius to Fahrenheit. The Celsius scale is a measurement of temperature. It’s a measurement of how hot or cold something is. °C is a popular abbreviation. Water freezes at 32°F and boils at 212°F under normal conditions, denoting a temperature scale on which water freezes at 32°F and boils at 100°F.

import java.util.Scanner;
public class Main
{
public static void main(String args[])
{
float cen;
double fah;
Scanner scan = new Scanner(System.in);
System.out.print("Enter Temperature in Cen");
cen = scan.nextFloat();
fah = (1.8*cen) + 32;
System.out.print("Equivalent Temperature is" + fah);
}
}

 

Output:

Enter Temperature in Centigrade : 45 Equivalent Temperature in Fahrenheit = 113.0

What is celsius and how to calculate it

The Celsius scale, often known as centigrade, is based on the freezing point and boiling point of water being 0° and 100°, respectively. It is commonly referred to as the centigrade scale because of the 100-degree difference between the specified values. Anders Celsius, a Swedish astronomer, created it in 1742.

Fahrenheit and it calculation methods

Relating to or containing a temperature scale in which water’s boiling point is 212°F and its freezing point is 32°F The Fahrenheit scale is used to measure temperature and is based on the freezing and boiling temperatures of water. At 32 degrees Fahrenheit, water freezes and boils at 212 degrees Fahrenheit. This is a scale that determines how hot or cold something is 11

Floating and Double keyword in java

Float

The abbreviation for “floating point” is “float.” According to the specification, it’s a built-in data type for describing numeric values with floating decimal points. The data type float is supported by C, C++, C#, and a number of other programming languages. Two additional common data types are integer and double.

Double

The double keyword is a basic data type in Java. It’s a double-precision 64-bit IEEE 754 floating-point. Variables and methods are declared here. In general, it is used to represent decimal numbers.