Bangeev

Coins

Nov 30th, 2018
152
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 0.79 KB | None | 0 0
  1. <?php
  2. $amouthToReturn = floatval(readline());
  3. $coints = $amouthToReturn * 100;
  4. $cointsCount = 0;
  5.  
  6.  
  7.  
  8.     while ($coints >= 200){
  9.         $coints -= 200;
  10.         $cointsCount++;
  11.     }
  12.     while ($coints >= 100){
  13.         $coints -= 100;
  14.         $cointsCount++;
  15.     }
  16.     while ($coints >= 50){
  17.         $coints -= 50;
  18.         $cointsCount++;
  19.     }
  20.     while ($coints >= 20) {
  21.         $coints -= 20;
  22.         $cointsCount++;
  23.     }
  24.     while ($coints >= 10) {
  25.         $coints -= 10;
  26.         $cointsCount++;
  27.     }
  28.     while ($coints >= 5){
  29.         $coints -= 5;
  30.         $cointsCount++;
  31.     }
  32.     while ($coints >= 2) {
  33.         $coints -=2;
  34.         $cointsCount++;
  35.     }
  36.     while ($coints >= 1) {
  37.         $coints -= 1;
  38.         $cointsCount++;
  39.     }
  40.    
  41.  
  42.  
  43. echo "$cointsCount";
Advertisement
Add Comment
Please, Sign In to add comment