← Back to Printing
Question 14
Temperature Conversion
Temperature Conversion
Create a float variable for Fahrenheit temperature with the value 98.6f. Convert it to Celsius using the formula: celsius = (fahrenheit - 32) * 5 / 9. Use cout with setprecision to display: 98.6°F = 37.0°C Both temperatures should be displayed with exactly 1 decimal place using fixed and setprecision(1). The conversion formula will give you 37.0 degrees Celsius.
Expected Output:
98.6°F = 37.0°C
Topics:
Printing
Code Editor
1
Tab to indent · Ctrl+Enter to run · Ctrl+Space to expand shortcuts (cout, fori)
Your Output
Run your code to see the output here...
Test Cases
Run your code to see test case results.