0

Why -4%5 => 1 //I understand -5%5 => 0 //I understand -6%5 => 4 // My mind has been deleted

I checked it in c/cpp, there result is just -1.

1 Answers1

1

-6: the biggest number that is less or equal to -6 and evenly divisible by 5 is -10.

# just like the other examples
-4 - (-5) == 1  
-5 - (-5) == 0  
-6 - (-10) == 4  # fits perfectly in there
-7 - (-10) == 3  
-8 - (-10) == 2  
user2390182
  • 72,016
  • 6
  • 67
  • 89