Putting it together · 모아보기
This page needs a recent browser (with SharedArrayBuffer support). Please update Chrome, Edge, Firefox or Safari to the latest version. · 이 페이지는 최신 브라우저(SharedArrayBuffer 지원)가 필요합니다. Chrome, Edge, Firefox 또는 Safari를 최신 버전으로 업데이트해 주세요.
One program uses several constructs
- A 9618 answer mixes
DECLARE,←,IF…THEN,FORandOUTPUT. - Indent the body of a loop. Put
THENon theIFline. - A short comment with
//says what a block is for.
// Total the five marks, then say whether the total reaches 20.
DECLARE Mark : ARRAY[1:5] OF INTEGER
Mark[1] ← 4
Mark[2] ← 8
Mark[3] ← 6
Mark[4] ← 2
Mark[5] ← 5
DECLARE Total : INTEGER
Total ← 0
FOR I ← 1 TO 5
Total ← Total + Mark[I]
NEXT I
OUTPUT "Total = ", Total
IF Total >= 20 THEN
OUTPUT "target met"
ELSE
OUTPUT "below target"
ENDIF
What this course left for A2
- Random files, classes, enumerated types and pointers are in the full 9618 guide.
- They are assessed at A2, not in this AS course.
- The IGCSE course on this site uses the 0478 rules for 2026–2028. Do not copy those into a 9618 answer.
Now you try
- Total an array, then choose a message with
IF.
The array is filled for you. Output Total = 25 on one line, then target met because 25 is at least 20. · 배열은 미리 채워져 있습니다. 25가 20 이상이기 때문에 한 줄에 Total = 25을 출력한 뒤 target met을 출력하십시오.
Click Run to see the output here. · 출력을 보려면 '실행'을 클릭하세요.