Advertisement
Guest User

Untitled

a guest
Mar 24th, 2019
82
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 0.57 KB | None | 0 0
  1. <?php
  2.  
  3. $points = intval(readline());
  4. $bonusPoints = 0;
  5.  
  6. switch ($points) {
  7.     case $points<=100:
  8.          $bonusPoints = 5;
  9.         break;
  10.    
  11.     case $points>100 && $points<=1000:
  12.          $bonusPoints = $points * 0.2;  
  13.         break;
  14.    
  15.     case $points>1000:
  16.          $bonusPoints = $points * 0.1;
  17.         break;
  18. }
  19.    
  20. switch ($points) {
  21.     case $points % 2 == 0:
  22.          $bonusPoints += 1;
  23.         break;
  24.    
  25.     case $points % 10 === 5:
  26.          $bonusPoints += 2;
  27.         break;
  28. }
  29. echo $bonusPoints.PHP_EOL;
  30. echo $points + $bonusPoints;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement