March 2019
Intermediate to advanced
336 pages
9h 9m
English
The g method takes two fractions and prints the series of reduced fractions. The g function takes an l or an r fraction, and num int as arguments to print the reduced fraction as a series. The following code snippet shows the g method:
// g methodfunc g(l fraction, r fraction, num int) { var frac fraction frac = fraction{l.numerator + r.numerator, l.denominator + r.denominator} if frac.denominator <= num { g(l, frac, num) fmt.Print(frac, " ") g(frac, r, num) }}
Read now
Unlock full access