Isn't the remainder should be 0?
But in programming 2%5=2, 4%5=4
Please explain

It should be 2. Generally. you get the remainder from (for positive number at least):

a % b = a - b * floor(a / b)

So:

2 % 5 = 2 - 5 * floor(2 / 5)
      = 2 - 5 * floor(0)
      = 2

In other words, 2 / 5 = 0, then there is still 2 "remaining" in the dividend.