← all problems

Fahrenheit to Celsius 🌶️

The program below is supposed to convert a Fahrenheit temperature to Celsius using the formula "Subtract 32 from degrees Farenheit and then multiply by five ninths", and print the result. It compiles and runs, but the printed answer is wrong. The formula itself is right; the problem is how it's written. Double-check how Java groups the operations in that expression, and fix it so it prints the correct Celsius value. Your code will be tested with several different temperatures.

Main.java — the program frame below is already written; you're only completing the code in the editable box. Your code will be run several times, each with different starting values for the variables at the top.

public class Main {
    public static void main(String[] args) {
        int fahrenheit = 212;
        // ---- write your code below ----
        System.out.println(celsius);
    }
}