Advertisement
desislava_topuzakova

4. Autonomy

Apr 16th, 2018
194
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.58 KB | None | 0 0
  1. <?php
  2. $widthFree = readline();
  3. $lengthFree = readline();
  4. $heigthFree = readline();
  5. $commands = "";
  6.  
  7. $volume = $widthFree * $lengthFree * $heigthFree;
  8. $sumVolume = 0;
  9. while ($sumVolume <= $volume) {
  10. $commands = readline();
  11. if($commands == "Done"){break;}
  12. else {
  13. $sumVolume += intval($commands);}
  14. }
  15. if ($sumVolume > $volume) {
  16. printf("No more free space! You need %d Cubic meters more.", $sumVolume - $volume);
  17. } else printf("%d Cubic meters left.", $volume - $sumVolume);
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement