ProceduralOCR J277
DashboardCoursePracticeReviewProgressGlossary
Saved on this deviceContinue learning

Procedural · OCR J277 programming practice

Progress stays in this browser unless you export it.

Course/Arithmetic/Sequence and arithmetic operators
J277 · 2.2.1

Unit 5 · Lesson 1

Sequence and arithmetic operators

Lesson progress0 / 7

Build the idea

Start with the concept and its key vocabulary.

Key idea

Trace a sequence and use the four basic arithmetic operators in a program.

Sequence is the simplest programming construct: each instruction runs in the order it is written. That order matters because a calculation can only use values that already exist. Use + for addition, - for subtraction, * for multiplication and / for ordinary division.

Sequence

Instructions executed in order, one after another, from top to bottom.

Arithmetic operator

A symbol that tells a program to perform a numerical calculation.

Expression

Values, variables and operators combined to produce a result.

Operand

A value or variable that an operator acts on.

Keep these in mind

  • Trace code from the first line to the last line.
  • A later line sees the values left by all earlier assignments.
  • Use * for multiplication; the letter x is not a programming operator.
  • The / operator performs ordinary division and can produce a decimal result.

Learning objective

Trace a sequence and use the four basic arithmetic operators in a program.

Exam tip

When tracing a sequence, write each new variable value immediately after its assignment. Do not calculate later lines early.

Common mistake

A mathematical expression on its own does not update a variable. Store its result with an assignment, such as total = price * quantity.

PreviousNext