WeBWorK Problems

Showing long division steps

Showing long division steps

by Robin Cruz -
Number of replies: 0

DOCUMENT();  

###################################

# Initialization section

loadMacros(

"PGstandard.pl",

"PGML.pl"

);

COMMENT("Need to finish showing the steps in the solution.");

###################################

# Set-up

Context("Numeric");

$d3 = random(5,8);

$d4 = random(11,20);

$q1 = Compute("$d3*$d4");

$r = $d3-random(0,$d3-1);

$qr = $q1+$r;

###################################

# Main text

BEGIN_PGML

Work out each division:  [`[$qr] \div [$d3]`] 

     The quotient is [____]{$d4}  with remainder:[____]{$r}

END_PGML

###################################

# Solution

BEGIN_PGML_SOLUTION

Work out the division:

NOTE: COULD THIS WORK WITH THE RIGHT PACKAGE? [`\intlongdivision{[$qr}{[$d3]}`]

    [`\begin{array}{r}[$d4]\\ [$d3]\enclose{longdiv}{[$qr]}\\**\\ \hline [$r]\end{array}`]

So, [`[$qr] \div [$d3] =[$d4]`] with remainder [`[$r]`]

END_PGML_SOLUTION

ENDDOCUMENT();