Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- $lost_games=(int)readline();
- $headsets=readline();
- $mice=readline();
- $keyboards=readline();
- $displays=readline();
- $price=0;
- $screens=0;
- $isDivisibleByTwo = False;
- for ($i = 1; $i <= $lost_games; $i+=1)
- {
- $isDivisibleByTwo = $i%2 == 0;
- if($isDivisibleByTwo){
- $price+=$headsets;
- }
- if($i%3 == 0){
- $price+=$mice;
- if($isDivisibleByTwo){
- $price+=$keyboards;
- $screens++;
- if($screens%2 == 0){
- $price+=$displays;
- }
- }
- }
- }
- printf("Rage expenses: %.2f lv.",$price);
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement