[Close]
Welcome to SmG Gaming Community!
You're browsing our website as a Guest.
In order to view all of our content as well as added bonus features, please register by clicking HERE.
Hello i am having trouble understanding the question I'm confused its for PHP, am i supposed to list Celsius to Fahrenheit as well, and if so do i need a "do while statement" i also have the code for the Celsius but how do i listed
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.
this is what i have
<?php
$FahrenheitTemp = 0;
while ($FahrenheitTemp <= 100)
{
$CelsiusTemp = ($FahrenheitTemp - (32 * 5/9));
echo $FahrenheitTemp." Fahrenheit is equal to ".round($CelsiusTemp)." Celsius<br />";
$FahrenheitTemp++;
}
?>
this is some of the result
0 Fahrenheit is equal to -18 Celsius
1 Fahrenheit is equal to -17 Celsius 2 Fahrenheit is equal to -16 Celsius 3 Fahrenheit is equal to -15 Celsius 4 Fahrenheit is equal to -14 Celsius s