Temperature Conversion
// Predetermined Fahrenheit temperature
$temp_f = 68;
// Calculate Celcius and round off result for legibility
$temp_c = (5.0/9.0) * ($temp_f - 32.0);
$temp_c = number_format($temp_c, 1, ",", ".");
// Output results
echo "Temperature in Fahrenheit: $temp_f °F
\n";
echo "Temperature in Celcius: $temp_c °C
\n";
?>
Back to Problem Set index page