fork download
  1. <?php
  2.  
  3. $n1=10;
  4. $n2=2;
  5.  
  6. $nSottrazioni = 0;
  7. if ($n1 > $n2) {
  8. $ris = $n1;
  9. while ($ris >= 0) {
  10. $ris = $ris - $n2;
  11. $nSottrazioni++;
  12. }
  13. } else {
  14. $ris = $n2;
  15. while ($ris >= 0) {
  16. $ris = $ris - $n1;
  17. $nSottrazioni++;
  18. }
  19. }
  20. echo "Numero sottrazioni= $nSottrazioni \n";
  21. echo "Risultato all'ultima sottrazione= $ris";
  22. ?>
Success #stdin #stdout 0.03s 24092KB
stdin
Standard input is empty
stdout
Numero sottrazioni= 6 
Risultato all'ultima sottrazione= -2