If you're seeing this message, it means we're having trouble loading external resources on our website.

If you're behind a web filter, please make sure that the domains *.kastatic.org and *.kasandbox.org are unblocked.

Main content

Mathematical expressions

AP.CSP: AAP‑2 (EU), AAP‑2.C (LO), AAP‑2.C.1 (EK), AAP‑2.C.2 (EK), AAP‑2.C.3 (EK), AAP‑2.C.4 (EK)


Melody is organizing a bake sale and making a program to help her plan the ingredients.
Each batch of cookies requires 3 eggs, and she's going to make 9 batches. This code calculates the total eggs required:
eggsInBatch ← 3 
numBatches ← 9
neededEggs ← eggsInBatch * numBatches
Melody realizes she'll need to buy more eggs than necessary, since she needs to buy eggs by the dozen.
Now she wants to calculate how many eggs will be leftover in the final carton of eggs. That will help her decide whether to make extra icing.
Which line of code successfully calculates and stores the number of leftover eggs in the final carton?
Choose 1 answer: