Advertisement
Guest User

Untitled

a guest
Jun 24th, 2018
246
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 0.51 KB | None | 0 0
  1.  <?php
  2. $lost_games=(int)readline();
  3. $headsets=readline();
  4. $mice=readline();
  5. $keyboards=readline();
  6. $displays=readline();
  7.  
  8. $price=0;
  9. $screens=0;
  10. $isDivisibleByTwo = False;
  11. for ($i = 1; $i <= $lost_games; $i+=1)
  12. {
  13.     $isDivisibleByTwo = $i%2 == 0;
  14.     if($isDivisibleByTwo){
  15.         $price+=$headsets;
  16.     }
  17.    
  18.     if($i%3 == 0){
  19.         $price+=$mice;
  20.        
  21.         if($isDivisibleByTwo){
  22.             $price+=$keyboards;
  23.             $screens++;
  24.             if($screens%2 == 0){
  25.                 $price+=$displays;
  26.             }
  27.         }
  28.     }
  29. }
  30. printf("Rage expenses: %.2f lv.",$price);
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement