fork(2) download
  1. <?php
  2.  
  3. /* требуемая сумма */
  4. $amount = 54500;
  5.  
  6.  
  7. echo "Сумма: $amount";
  8. if (($amount > 100)&(($amount % 100) == 0)){
  9. echo "\nВыдача возможна, число купюр: ";
  10. $output5000 = floor($amount / 5000);
  11. $amountLeft = $amount % 5000;
  12. $output1000 = floor($amountLeft / 1000);
  13. $amountLeft = $amountLeft % 1000;
  14. $output500 = floor($amountLeft / 500);
  15. $amountLeft = $amountLeft % 500;
  16. $output100 = floor($amountLeft / 100);
  17. $amountLeft = $amountLeft % 100;
  18. echo "\n$output5000 х 5000, ";
  19. echo "$output1000 х 1000, ";
  20. echo "$output500 х 500, ";
  21. echo "$output100 x 100";
  22. }
  23. elseif ($amount < 100){
  24. echo "\nВыдача невозможна. Причина: сумма меньше 100 рублей.";
  25. }
  26. elseif (($amount % 100) != 0){
  27. echo "\nВыдача невозможна. Причина: сумма не кратна 100 рублям.";
  28. }
  29.  
  30.  
  31. ?>
Success #stdin #stdout 0.01s 20520KB
stdin
Standard input is empty
stdout
Сумма: 54500
Выдача возможна, число купюр: 
10 х 5000, 4 х 1000, 1 х 500, 0 x 100