randRange(1, 9) randRange(2, 9) randRange(1, 9) randRange(2, 9) getGCD( N1, N2 ) N1 / GCD1 N2 / GCD1 getGCD( D1, D2 ) D1 / GCD2 D2 / GCD2
Reduce to lowest terms:

\displaystyle \frac{N1}{D1} \div \frac{N2}{D2} = {?}

(N1 * D2) / (D1 * N2)

Turn into a multiplication problem:

\displaystyle {} = \frac{N1}{D1} \times \frac{D2}{N2}

Reduce terms with common factors:

\displaystyle {} = \frac{SIMP_N1}{SIMP_D1} \times \frac{SIMP_D2}{SIMP_N2}

Combine into one fraction:

\displaystyle {} = \frac{SIMP_N1 \times SIMP_D2}{SIMP_D1 \times SIMP_N2}

Simplify:

\displaystyle {} = fractionReduce(N1* D2, D1 * N2)