converting between Celsius and fahrenheit.

I need help please. I tried so many times but cab't figure out how to do it!!!
Write a program that prompts for and reads a floating point number and a letter. If the letter following the number is F, the program is to treat the number entered as a temperature in degrees Fahrenheit, convert the number to equivalent degrees Celsius, and display both temperatures. If the letter following the number is C, the program is to treat the number entered as a temperature in Celsius, convert the number to the equivalent degrees Fahrenheit, and display both temperatures. Note: You may assume that the user will enter an F or a C for the letter.
Can you show us one of your attempts? I could whip up a solution in less than 2 minutes, but it won't help you learn anything if I do.
Perhaps this task may help in practicing and tuning your solution.

http://codeabbey.com/index/task_view/fahrenheit-celsius

Correct answers would be shown in case your own answers are wrong...

Formulas for conversion are pretty simple

F = C * 9 / 5 + 32
C = (F - 32) * 5 / 9
Last edited on
Topic archived. No new replies allowed.