In AP Computer Science A, the remainder operator (%) is the arithmetic operator that evaluates to the remainder after dividing one number by another, so 15 % 4 evaluates to 3. It is one of Java's five arithmetic operators (+, -, *, /, %) covered in Topic 1.3.
The remainder operator (%) is one of Java's five arithmetic operators, alongside addition, subtraction, multiplication, and division (EK 1.3.C.2). It answers a simple question. After you divide one number by another using integer division, what's left over? So 15 % 4 is 3, because 4 goes into 15 three times (that's 12) with 3 remaining. Think of it as the partner to /. Integer division gives you the quotient, and % gives you everything / threw away.
Like the other arithmetic operators, % follows Java's type rules. If both operands are int, the result is an int. If at least one operand is a double, the result is a double. The classic uses you'll see all over AP code are checking if a number is even (n % 2 == 0), grabbing the last digit of a number (n % 10), and wrapping a value back to zero when it hits a limit. One Java quirk worth memorizing is that with negative numbers, the result takes the sign of the left operand, so -7 % 3 is -1, not 2.
The remainder operator lives in Topic 1.3 (Expressions and Assignment Statements) in Unit 1, supporting learning objective 1.3.C, which asks you to develop code for arithmetic expressions and determine what they evaluate to. That phrase "determine the result" is the whole game. The AP exam loves handing you a code segment with / and % mixed together and asking exactly what prints, because it tests whether you actually understand integer arithmetic or just skimmed it. Beyond Unit 1, % keeps showing up for the rest of the course. Even/odd checks in loop conditions, digit-by-digit number processing, and cycling through positions in a list all run on the remainder operator, so a shaky grasp of it in Unit 1 costs you points in every later unit.
Keep studying AP® Computer Science A Unit 1
Integer Division (Unit 1)
Division and remainder are two halves of the same operation. 15 / 4 gives you 3 (the integer quotient) and 15 % 4 gives you 3 (the leftover). The exam pairs them constantly, because if you understand one, you can sanity-check the other. Quotient times divisor plus remainder gets you back to the original number.
Operator Precedence (Unit 1)
In Java, % has the same precedence as * and /, and operators at the same level evaluate left to right. That's why 25 % 7 % 3 means (25 % 7) % 3, which is 4 % 3, which is 1. Tracing chained operators is a favorite MCQ move.
Modular Arithmetic (Unit 1)
The remainder operator is how Java does modular arithmetic, the math of clocks and cycles. When you write hour % 12 or index % array.length, you're wrapping a value around so it never exceeds a limit. This idea powers circular traversal patterns you'll write in later units.
Arithmetic Expression (Unit 1)
Per EK 1.3.C.1, % is one of the building blocks of arithmetic expressions, combining with values and variables to produce int or double results. The int-vs-double evaluation rule applies to % exactly like it applies to every other arithmetic operator.
Remainder shows up in "what is printed?" multiple-choice questions, usually right next to integer division. A typical stem gives you something like int x = 15; int y = 4; and asks what x / y and x % y print (here, 3 3). Harder versions chain operators, like 25 % 7 % 3, where you have to apply left-to-right evaluation step by step. On FRQs, % rarely gets named in the prompt, but you'll reach for it yourself when a problem says "every other element," "the last digit," "divisible by," or "wraps around." Writing n % 2 == 0 for evenness or n % d == 0 for divisibility is one of the most reusable moves in the whole course. The skill the CED demands (LO 1.3.C) is twofold. You have to trace expressions that use % and produce the exact output, and you have to write expressions using % when a problem secretly calls for it.
With two int operands, / keeps the whole-number quotient and throws away the remainder, while % keeps the remainder and throws away the quotient. For 15 / 4 you get 3 because 4 fits into 15 three times. For 15 % 4 you also get 3, but for a different reason. That's the leftover after taking out three 4s. They happen to match here, which is exactly why this example shows up on tests. Quick check: (x / y) * y + (x % y) always equals x.
The remainder operator (%) evaluates to what's left over after integer division, so 15 % 4 is 3 and 20 % 5 is 0.
An expression like n % d equals 0 exactly when n is divisible by d, which makes n % 2 == 0 the standard even-number check.
The % operator has the same precedence as * and /, and same-level operators evaluate left to right, so 25 % 7 % 3 means (25 % 7) % 3, which is 1.
If both operands are int the result is an int, and if at least one operand is a double the result is a double, just like every other arithmetic operator (EK 1.3.C.2).
With negative operands, the result takes the sign of the left operand, so -7 % 3 evaluates to -1 in Java.
The result of x % y is always smaller in magnitude than y, which is why % is the go-to tool for wrapping values around a limit.
It's the % symbol, one of Java's five arithmetic operators (EK 1.3.C.2). It evaluates to the remainder after dividing the left operand by the right one, so 15 % 4 is 3 and 12 % 4 is 0.
No. Despite the symbol, % has nothing to do with percentages in Java. It computes the remainder of a division, so 50 % 100 is 50, not half. Reading % as "percent" is one of the fastest ways to miss an Unit 1 MCQ.
With two ints, / gives the whole-number quotient and % gives the leftover. For 25 and 7, 25 / 7 is 3 and 25 % 7 is 4. Together they recover the original number, since 3 * 7 + 4 = 25.
In Java, -7 % 3 evaluates to -1, not 2. The result of % takes the sign of the left operand. This trips up students coming from math class, where mod is usually defined to be non-negative.
Use n % 2 == 0. If the remainder when dividing by 2 is zero, the number is even. The same pattern generalizes, since n % d == 0 is true exactly when n is divisible by d, a check you'll write constantly on FRQs.
Connect this key term to the AP exam workflow: review the course, practice questions, and check related study tools.
Review units, study guides, and course resources.
Check this vocabulary in multiple-choice context.
Apply key concepts in written AP responses.
Estimate the exam score you are working toward.
Review the highest-yield facts before practice.
Put the full course together before test day.