Published by Patrick Mutisya · 14 days ago
Write pseudocode that demonstrates:
IF statement with an ELSE clause.IF statements.The general form of an IF‑ELSE statement in pseudocode is:
| Component | Pseudocode |
|---|---|
| Condition | IF condition THEN |
| True block | … statements … |
| Else block | ELSE |
| False block | … statements … |
| End | END IF |
Example – deciding whether a student passes:
When a decision depends on more than one condition, an IF can be placed inside another IF block. The syntax remains the same; the inner IF is simply indented for readability.
General pattern:
Example – grading a test based on two criteria:
END IF – leads to ambiguous block termination.ELSE without a preceding IF block.Write pseudocode to determine the shipping cost for an online order. The rules are:
Include both an IF‑ELSE version and a nested IF version.