Current time: 04 May 2024, 04:57 AM



Need help with homework
Offline Master

Registered User
Registered
11 Years of Service
Posts: 225
Threads: 124
Likes Received: 0 in 0 posts
Likes Given: 0
Joined: Feb 2013
Reputation: 0
Bronze Medal
#1
Need help with homework

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


04 Feb 2018, 01:46 AM
Find


Messages In This Thread
Need help with homework - by Master - 04 Feb 2018, 01:46 AM
RE: Need help with homework - by FlasH™ - 04 Feb 2018, 03:29 PM
RE: Need help with homework - by Cyrusthemuffinman - 03 Jun 2018, 03:17 PM
RE: Need help with homework - by UreshiiShiro - 03 Jun 2018, 03:23 PM
RE: Need help with homework - by Zemox - 03 Jun 2018, 04:52 PM

Forum Jump:


Users browsing this thread: 1 Guest(s)
SmG Gaming, © 2010-2024
Theme By: «SmG» Cloud
Edited by: «SmG» Wires