Skip to content

Commit 2dec44a

Browse files
committed
Update remainder.md
1 parent 839b426 commit 2dec44a

File tree

1 file changed

+7
-2
lines changed

1 file changed

+7
-2
lines changed

src/integers/remainder.md

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,13 +3,18 @@
33
To get the remainder of the division between two integers you can use the `%` operator.
44
This is called the "modulo operator."
55

6+
With `int`s `7 / 2` will give you `3`. That `3` is the "quotient" from the division
7+
and is the number of times `2` can be taken out of `7`. This leaves a "remainder" of `1`.
8+
9+
The modulo operator gives you that remainder.
10+
611
```java
712
~void main() {
813
int x = 5;
9-
// The remainder of 5 / 2 is 1
14+
// 5 / 2 is 2 with a remainder of 1
1015
// y will be 1
1116
int y = x % 2;
12-
// The remainder of 5 / 3 is 2
17+
// 5 / 3 is 1 with a remainder of 2
1318
// z will be 2
1419
int z = x % 3;
1520

0 commit comments

Comments
 (0)