
Implement a function that divides a by b and writes the quotient and the remainder through q and r, choosing the pair whose remainder is never negative.
div_mod_floor(7, 2, &q, &r)Expected result
3 1For your own tracking. Tests grade your code.
div_mod_floor(-7, 2, &q, &r)Expected result
-4 1div_mod_floor(7, -2, &q, &r)Expected result
-3 1div_mod_floor(-1, 5, &q, &r)Expected result
-1 4div_mod_floor(-8, -4, &q, &r)Expected result
2 0Expected files
div_mod_floor.cAllowed functions
None. Write every helper yourself.

v0.40: Create exercises. Challenge the community.
Meet Studio →Implement a function that divides a by b and writes the quotient and the remainder through q and r, choosing the pair whose remainder is never negative.
div_mod_floor(7, 2, &q, &r)Expected result
3 1For your own tracking. Tests grade your code.
div_mod_floor(-7, 2, &q, &r)Expected result
-4 1div_mod_floor(7, -2, &q, &r)Expected result
-3 1div_mod_floor(-1, 5, &q, &r)Expected result
-1 4div_mod_floor(-8, -4, &q, &r)Expected result
2 0Expected files
div_mod_floor.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.