Lab 3 / Flowcharts to pseudocode
Lab 120.3C - Pseudocode to flowcharts
Overview
Learning objectives
BEGIN Main
INPUT n
IF n < 2 THEN
OUTPUT "Not prime"
ELSE
SET prime TO true
FOR i FROM 2 TO sqrt(n)
IF n MOD i = 0 THEN
SET prime TO false
BREAK
ENDIF
NEXT i
IF prime THEN
OUTPUT "Prime"
ELSE
OUTPUT "Not prime"
ENDIF
ENDIF
END MainInstructions
Last updated
Was this helpful?