Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- $side = floatval(readline());
- $sheetCount = intval(readline());
- $coverPerSheet = floatval(readline());
- $presentArea = pow($side, 2) * 6;
- $coverTotal = 0;
- while ($sheetCount > 0) {
- if ($sheetCount % 3 == 0) {
- $coverTotal += $coverPerSheet * 0.25;
- } else {
- $coverTotal += $coverPerSheet;
- }
- $sheetCount--;
- }
- $percent = ($coverTotal / $presentArea) * 100;
- printf("You can cover %.2f%% of the box.", $percent);
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement