Write a program to input the temperature in Fahrenheit and change it to Celsius. Formula: 5 = −32 9 where C = Celsius and F = Fahrenheit
Answers
import java.util.Scanner;
public class Temperature {
public static void main (String args []) {
Scanner sc=new Scanner (System.in);
System.out.print("Please enter the temperature in F : ");
double F = sc.nextDouble();
double C = (F-32) * 5/9.0;
System.out.println("Conversion to Celsius : "+C);
sc.close();
}
}
Answer:
important java.util.*;
public class program
{
public static void main (String args[])
{
Scanner scr = new Scanner(System.in) ;
double a,b
System.out.println("Enter the value of Fahrenheit");
a = scr.nextDouble();
b = (a-32)*5/9;
System.out.println(a + " Fahrenheit is equal to" + b + " celsius");
}
}