Knaph

First Contact6 of 62

Fahrenheit to Celsius

Read a single floating-point temperature in Fahrenheit from standard input and print its Celsius equivalent, rounded to the nearest whole number, with no extra text. The formula: celsius = (fahrenheit - 32) * 5 / 9. The starter code already reads the input into fahrenheit using fmt.Scan — &fahrenheit passes a pointer to it so Scan can write into the variable directly (you'll see pointers properly in a later module; for now, just know &variable is how you hand a variable's address to something that needs to fill it in). Print only the final integer — no units, no extra words.

Sign in to try this exercise.