0) First, read this link.
1) Write down on paper a process that you would use to convert a temperature in Fahrenheit to Celcius by hand. Write it down as accurately, precisely, and concisely as possible.
2) Then work out how to implement that process in code.
If you dance barefoot on the broken glass of undefined behaviour, you've got to expect the occasional cut.
If at first you don't succeed, try writing your phone number on the exam paper.