Programming logic is the systematic sequence of instructions that solves a problem. Whether using Python, SQL, or Java, developers rely on core constructs—variables, conditionals, loops, and functions—to create maintainable code. This topic covers structured and object‑oriented approaches, algorithm design, and common debugging practices.
+ - * / %
), relational (< > ==
), logical (AND OR NOT
).if
/else
), iteration (for/while loops).SELECT
, INSERT
, UPDATE
, joins, and Boolean filtering.Problem: Write pseudocode to calculate the average test score from an array and print whether each student passed (≥ 70) or failed.
START scores ← [85, 72, 68, 90, 77] total ← 0 FOR each score IN scores DO total ← total + score IF score >= 70 THEN PRINT "Pass: " + score ELSE PRINT "Fail: " + score ENDIF ENDFOR average ← total / length(scores) PRINT "Class Average = " + average END
Explanation:
FOR
loop over the arrayIF
statement for pass/fail logicAnswer: The algorithm outputs individual results and the class average in O(n) time.