You will use an appropriate looping statement to write a script that displays a list of the Celsius equivalents of zero degrees Fahrenheit through 100 degrees Fahrenheit. To convert Fahrenheit to Celsius, subtract 32 from the Fahrenheit temperature, and then multiply the remainder by (5/9). To convert Celsius to Fahrenheit, multiply the Celsius temperature by (9/5), and then add 32. Use the round () function you learned in chapter 1 to display the Celsius temperature to one place after the decimal point. Save the document as TempConversion.php. [ Use php script solve this problem]
To convert Fahrenheit to Celsius
<?php
for($F=0;$F<100;$F++)
{
$C=(5/9) * ($F -32);
echo round($C,1);
echo "<br>";
}
?>
To convert Celsius to Fahrenheit
<?php
for($C=0;$C<100;$C++)
{
$F=$C*(5/9) +32;
echo round($F,1);
echo "<br>";
}
?>
Get Answers For Free
Most questions answered within 1 hours.