Convert Temperature Between Units
C++
Easy
6 views
Problem Description
Convert temperature from Celsius to Fahrenheit and Kelvin using appropriate data types for decimal precision.
Logic: Apply conversion formulas using float/double
Official Solution
void question5_temperature_conversion() {
double celsius = 25.5;
double fahrenheit = (celsius * 9.0 / 5.0) + 32.0;
double kelvin = celsius + 273.15;
cout << celsius << " Celsius = " << fahrenheit << " Fahrenheitn";
cout << celsius << " Celsius = " << kelvin << " Kelvinn";
}
Solutions (0)
No solutions submitted yet. Be the first!
No comments yet. Start the discussion!