Advertisement
Guest User

match

a guest
Apr 21st, 2019
148
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 0.65 KB | None | 0 0
  1. <?php
  2.  
  3. $priceTicketGo = floatval(readline());
  4. $priceTicketBack = floatval(readline());
  5. $PriceForOneMatch = floatval(readline());
  6. $matchCount = intval(readline());
  7. $percentDiscount = intval(readline());
  8.  
  9. $totalPriceTickets = 6 * ($priceTicketGo + $priceTicketBack);
  10. $discountTickets = ($totalPriceTickets * $percentDiscount) / 100;
  11. $afterDiscount = $totalPriceTickets - $discountTickets;
  12.  
  13. $totalMactchMoney = 6 * $matchCount * $PriceForOneMatch;
  14.  
  15. $moneyForAll = $afterDiscount + $totalMactchMoney;
  16.  
  17. $moneyForEach = $moneyForAll / 6;
  18.  
  19. printf("Total sum: %.2f lv.".PHP_EOL, $moneyForAll);
  20. printf("Each friend has to pay %.2f lv.", $moneyForEach);
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement