Modulo Magic
C
Hard
4 views
Problem Description
Test the modulo operator with negative numbers. What result will -7 % 3 give? What difference can there be between different couplings?
Official Solution
#include <stdio.h>
int main() {
int a = -7;
int b = 3;
printf("-7 %% 3 = %dn", a % b);
printf("-7 / 3 = %dn", a / b);
return 0;
}
Solutions (0)
No solutions submitted yet. Be the first!
No comments yet. Start the discussion!