Write a program that will take as input a temperature in degrees Fahrenheit and will convert and output the temperature in degrees Celsius. (Hint: DegreesC = (DegreesF – 32) * 5/9)
Answers
Answered by
0
Answer:
import java.util.Scanner;
public class Main {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
System.out.print("Enter temperature in Fahrenheit : ");
double fahrenheit = sc.nextDouble();
double celsius = ((fahrenheit-32) * 5/9);
System.out.println(celsius + "C");
}
}
Explanation:
- Accepting the Fahrenheit temperature from the user.
- Using the formula : DegreesC = (DegreesF – 32) * 5/9) and storing it in a variable 'celsius' typed double.
- Printing the result in the console.
Similar questions