\$M0 = $M0 \$M1 = $M1
\n"; // copies the M0 content (n) in M2: $M2 = 0; // echo "before: \$M2 = $M2 \$M0 = $M0
\n"; $M2 = $M2 + $M0; // echo "after: \$M2 = $M2 \$M0 = $M0
"; // computes r = n - 4*[n/4] and puts the result into $M0: // echo "0: \$M0 = $M0 \$M1 = $M1 \$M2 = $M2
\n"; $M2 = (int)($M2/$M1); // echo "1: \$M0 = $M0 \$M1 = $M1 \$M2 = $M2
\n"; $M2 = $M2 * $M1; // echo "2: \$M0 = $M0 \$M1 = $M1 \$M2 = $M2
\n"; $M0 = $M0 - $M2; // echo "3: \$M0 = $M0 \$M1 = $M1 \$M2 = $M2
\n"; // if $M0 != 0 (i. e., r != 0) jumps to 14 if ($M0 != 0) { // echo "flow 1: \$M0 = $M0 \$M1 = $M1 \$M2 = $M2
\n"; $M1 = 0; // writes 0 in $M1 if r != 0 and stops } else { // echo "flow 2: \$M0 = $M0 \$M1 = $M1 \$M2 = $M2
\n"; $M1 = 0; // writes 1 in $M1 if r == 0 and stops $M1++; } echo "the result: \$M1 = $M1
\n"; $dividend_n = $_GET['n']; $divisor_d = $_GET['d']; if ($divisor_d == 0) echo "Be carefull !! d must not be 0.
\n"; else { if ($M1 == 0) echo "$dividend_n is not a multiple of $divisor_d
"; if ($M1 != 0) echo "$dividend_n is a multiple of $divisor_d
"; } echo ''; } else { echo 'Theorem: Given any two Natural numbers n (dividend) and d (divisor) where d>0, there exists only one couple of natural nambers q (quotient) and r (reminder) such that n = q * d + r with r is less than d.
Program requrements: Given any two Natural numbers n and d with d>0 as input, the present program checks if n is a multiple of d (i. e., the reminder r above is equal to 0) or not.
'; } ?>