Hi there! This article will create a simple temperature converter from fahrenheit to celsius and vice versa. We will be using the following formula:
Visit my post about Celsius to Fahrenheit in Java here.
Formula
C x 9/5 + 32 = F
(F - 32) x 5/9 = C
First, we will convert Celcius to Fahrenheit. Let's try to convert 32 degrees Celsius to degrees Fahrenheit.
PHP Code
Celsius to Fahrenheit
<?php
$c=32;
$f=$c*9/5+32;
echo $f."F";
?>
Fahrenheit to Celsius
<?php
$f=89.6;
$c=($f-32)*5/9;
echo $c."C";
?>
Output
0 comments:
Post a Comment