<?php
$A = intval(trim(fgets(STDIN)));
do {
    $B = intval(trim(fgets(STDIN)));
} while($B == 0);
if (($A > 0 && $B > 0) || ($A < 0 && $B <0)) {
    for($quociente = 0; abs($A) >= abs($B); $A -= $B, $quociente++);
} else {
    for($quociente = 0; abs($A) >= abs($B); $A += $B, $quociente--);
}
echo $quociente."\n",$A;
?>

Embed on website

To embed this project on your website, copy the following code and paste it into your website's HTML: