Write a Java program to enter temperature in Fahrenheit and convert to Celsius
(Hint)
C= (f-32)*9/5
Static :-
class Celsius
{
public static void main(String args[])
{
Double fah = 205.0;
Double cel;
cel = (fah - 32)*5/9;
System.out.println("The temperature in Celsius is :- "+cel);
}
}
Output :-
Dynamic
import java.util.*;
class Celsius
{
public static void main(String args[])
{
Scanner in = new Scanner(System.in);
System.out.println("Enter the Temperature in Faherenheit :-");
double fah = in.nextDouble();
double cel = (fah-32)*5/9;
System.out.println("The temperature in Celsius is :- "+cel);
}
}
Output :-