Created
June 8, 2019 15:19
-
-
Save nellytadi/42d1a49b63634802982826e2235aac97 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
public function degrees($hour, $min) | |
{ | |
$degree = $hour*30 + $min *6; | |
if ($degree>360){ | |
$result= $degree - 360; | |
} | |
elseif ($degree< 360) { | |
$result = $degree; | |
} | |
echo $result.' degrees'; | |
} | |
?> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
`<?php
//practical solution
$hour = 2;
$min = 45;
$degree = $hour * 30 + $min * 6;
if ($degree>360){
$result= $degree - 360;
echo $result.' degrees';
}
elseif ($degree< 360) {
$result = $degree;
echo $result.' degrees';
}
?>`