NastySwipy

Exam - 7 January 2018 - 02. Airplane

Feb 27th, 2018
141
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 0.31 KB | None | 0 0
  1. <?php
  2. $h = intval(readline());
  3. $m = intval(readline());
  4. $flightDuration = readline();
  5. $sum = ($flightDuration + $m) / 60;
  6. $min = ($flightDuration + $m) % 60;
  7. $finalHours = floor($sum + $h);
  8. if ($finalHours >= 24) {
  9.     $finalHours -= 24;
  10. }
  11. echo sprintf("%01.0fh ", $finalHours);
  12. echo sprintf("%01.0fm", $min);
Advertisement
Add Comment
Please, Sign In to add comment