Question

What are the times during that day that a clock's hands are 180 degrees apart?

Answer by Rachel C

1 : 1:38
2 : 2:43
3 : 3:49
4 : 4:54
5 : 5:59
6 : 6:00
7 : 7:05
8 : 8:10
9 : 9:16
10 : 10:21
11 : 11:27
12 : 12:32

<?php for ($i = 1; $i < 13; $i++) { print $i . " : "; print OneEightyCircle($i); print "
"; } function OneEightyCircle($hour) { $min = ($hour + 6) * 5; if ($min >= 60) $min = $min - 60; $maxMin = $min + 4; if (floor($maxMin/12) == floor($min/12)) { // really only have one option here $finalMin = $min + floor($min/12); } else { // now have two options $d1 = floor($min/12); $d2 = floor($maxMin/12); $htest = ($hour * 5) + $d2 + 30; if ($htest > 60) $htest = $htest - 60; if ($htest >= ($d2 * 12)) { $finalMin = $min + $d2; } else { $finalMin = $min + $d1; } } if ($finalMin < 10) { $time = $hour . ":0" . $finalMin; } else { $time = $hour . ":" . $finalMin; } return $time; } ?>