
Reduce the fraction held in r in place by dividing num and den by their greatest common divisor, with the sign carried by num so den ends up strictly positive.
rational_reduce(&r) with r = {6, 8}Expected result
3/4For your own tracking. Tests grade your code.
rational_reduce(&r) with r = {42, -14}Expected result
-3/1rational_reduce(&r) with r = {-6, -8}Expected result
3/4rational_reduce(&r) with r = {0, -9}Expected result
0/1Expected files
rational_reduce.cAllowed functions
None. Write every helper yourself.

v0.40: Create exercises. Challenge the community.
Meet Studio →Reduce the fraction held in r in place by dividing num and den by their greatest common divisor, with the sign carried by num so den ends up strictly positive.
rational_reduce(&r) with r = {6, 8}Expected result
3/4For your own tracking. Tests grade your code.
rational_reduce(&r) with r = {42, -14}Expected result
-3/1rational_reduce(&r) with r = {-6, -8}Expected result
3/4rational_reduce(&r) with r = {0, -9}Expected result
0/1Expected files
rational_reduce.cAllowed functions
None. Write every helper yourself.

Run the tests to grade your code
Build your code, then check each test here. Open a result to inspect its output.