bewerking=bewerking1.proc
!if $taal=nl
    somtekst1=Deel de volgende breuken op elkaar<br>\
    en vereenvoudig de uitkomst zo ver mogelijk:<br>
    nivo_title=Delen van breuken.
!else
    nivo_title=Dividing Fractions
    somtekst1=Divide the next fractions and<br>\
    reduce the outcome<br>    
!endif    
lijst_a=!shuffle 1,3,5,7,9,11,13
lijst_b=!shuffle 2,3,4,5,6 
lijst_c=!shuffle 2,3,4,5,6
lijst_d=!shuffle 3,5,7,9,11,13

totaal=$empty    
R=$graad
!for n=1 to $aantal_sommen
    !if $negatief=0
	!if $graad=0
	    R=$n
	!endif    	
	!if $R=1
	    #($AA/$BB)/($CC)
	    AA=!randitem 1,2,3
	    BB=!randitem 4,5,6,7,8,9
	    CC=!randitem 2,3,4
	!endif    	
	!if $R=2
	    #$AA/($BB/$CC)	    
	    AA=!randitem 1,2,3,4,5,6,7
	    CC=!randitem 4,5,6,7,8,9
	    s=!randitem 1,2,3
	    BB=$[$CC -$s]
	!endif    	
	!if $R>2
	    #($AA/$BB)/($CC/$DD)	    
	    AA=!randitem 1,2,3,4
	    BB=$[$AA + $n]
    	    CC=!randitem 1,2,3,4
    	    DD=$[$CC*($n+1)]
	!endif    	
    !else
	AA=!item $n of $lijst_a
	BB=!item $n of $lijst_b
        CC=!item $n of $lijst_c
        DD=!item $n of $lijst_d
	!if $graad=0
	    R=$n
	!endif    	
	!if $R=1
	    AA=!randitem $[-1*$n],$n
	!endif    	
	!if $R=2
	    AA=!randitem $[-1*$n],$n
	    BB=$[-1*$BB]	    
	!endif    	
	!if $R=3
	    AA=!randitem $[-1*$AA],$AA
	    CC=$[-2*$CC]
	    BB=$[2*$BB]
	!endif    	
	!if $R>3
	    AA=!randitem $[-1*$AA],$AA
	    CC=$[-2*$CC]
	    BB=$[2*$BB]
	    DD=!randitem $[-1*$DD],$DD,$DD	    
	!endif    	
    !endif
    !if $R=1
	som$n=($AA/$BB)/($CC)
	totaal=!append line (($AA/$BB)/($CC)) to $totaal
	totaal=!append line printtex(($AA/$BB)/($CC)) to $totaal
	opgave$n=\frac{\left(\frac{$AA}{$BB}\right)}{$CC}
    !endif
    !if $R=2
	som$n=$AA/($BB/$CC)	    
	totaal=!append line ($AA/($BB/$CC)) to $totaal
	totaal=!append line printtex($AA/($BB/$CC)) to $totaal
	opgave$n=\frac{$AA}{\left(\frac{$BB}{$CC}\right)}
    !endif
    !if $R>2    
	som$n=($AA/$BB)/($CC/$DD)	    
	totaal=!append line  (($AA/$BB)/($CC/$DD)) to $totaal
	totaal=!append line  printtex(($AA/$BB)/($CC/$DD)) to $totaal
	opgave$n=\frac{\left(\frac{$AA}{$BB}\right)}{\left(\frac{$CC}{$DD}\right)}
    !endif	
!next n

totaal=!exec pari $totaal
i=1
!for n=1 to $aantal_sommen
    GOED$n=!line $i of $totaal
    goed$n=!line $[$i+1] of $totaal
    i=$[$i+2]	 
!next n