Below is some code in C++. If you try something like -2%5
in python the result is positive 3 while many other languages like c++ C# (code) and flash give -2
Why do they give -2 and is one version more correct than the other?
#include <cstdio>
int main(){
printf("%d\n", 2%5);
printf("%d\n", -2%5);
printf("%d\n", -2%77);
printf("%d\n", 2%-77);
printf("%d\n", -2%-77);
}
Output:
2
-2
-2
2
-2