We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 839b426 commit 2dec44aCopy full SHA for 2dec44a
src/integers/remainder.md
@@ -3,13 +3,18 @@
3
To get the remainder of the division between two integers you can use the `%` operator.
4
This is called the "modulo operator."
5
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
11
```java
12
~void main() {
13
int x = 5;
-// The remainder of 5 / 2 is 1
14
+// 5 / 2 is 2 with a remainder of 1
15
// y will be 1
16
int y = x % 2;
-// The remainder of 5 / 3 is 2
17
+// 5 / 3 is 1 with a remainder of 2
18
// z will be 2
19
int z = x % 3;
20
0 commit comments