r/javahelp • • Mar 27 '21

Solved 1%2=1?

i dontunderstand the results when the nr to the right is larger

ofc 4%3=1

but why 3%4=3

2 Upvotes

13 comments sorted by

View all comments

13

u/[deleted] Mar 27 '21

If 1 is unable to be divided by 2, 1 is left over.

If 4 is divisible by three, divide. 4-3 = 1. If 1 is not divisible by 3, then 1 is left over.