Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- $volume = readline();
- $firstFlowRate = readline();
- $secondFlowRate = readline();
- $hoursMiss = readline();
- $firstFlowRate *= $hoursMiss;
- $secondFlowRate *= $hoursMiss;
- $totalDebit = $firstFlowRate + $secondFlowRate;
- $over = abs($volume - $totalDebit);
- $full = ceil(($totalDebit / $volume) * 100.0);
- $fullFirstPipe = floor(($firstFlowRate / $totalDebit) * 100.0);
- $fullSecondPipe = floor(($secondFlowRate / $totalDebit) * 100.0);
- if($totalDebit <= $volume){
- echo "The pool is $full% full. Pipe 1: $fullFirstPipe%. Pipe 2: $fullSecondPipe%.";
- }
- else{
- echo "For $hoursMiss hours the pool overflows with $over liters.";
- //echo "For $hoursMiss hours the pool overflows with " . number_format($over, 1) . ' liters.';
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement