Write a program in java to enter temperature in Fahrenheit and
convert it into Celsius.
Answers
Answered by
1
Answer:
import java.util.Scanner;
public class Fahrenheit_Celsius
{
public static void main(String[] args)
{
double celsius, fahrenheit;
Scanner s = new Scanner(System.in);
System.out.print("Enter temperature in Fahrenheit:");
fahrenheit = s.nextDouble();
celsius = (fahrenheit-32)*(0.5556);
System.out.println("Temperature in Celsius:"+celsius);
}
}
Answered by
2
Question:-
- Write a program in java to enter a temperature in Fahrenheit and convert it into Celsius.
Code:-
Using this formula, we will calculate.
So, here is the code.
import java.util.*;
class Temperature
{
public static void main(String args[])
{
Scanner sc = new Scanner(System.in);
System.out.println("Enter the temperature in Fahrenheit Scale: ");
double f=sc.nextDouble();
double c=5*(f-32)/9.0;
System.out.println("Temperature in celsius is: "+c);
}
}
Similar questions