Introduction to Flowcharts
3. Control Flow Structures in Flowcharts
Control flow refers to the order in which individual statements, instructions, or function calls are executed. Flowcharts represent three fundamental control structures:
3.1 Sequence Structure
Definition: Steps are executed one after another in linear sequence.
Flowchart Representation: A straight line of connected symbols (no branches).
Example: Addition of two number
3.2 Selection Structure (Decision Making)
Definition: Different paths are taken based on a condition.
Flowchart Representation: Diamond symbol with multiple outgoing paths.
Types:
i. Simple Selection: If-then structure
ii. Double Selection: If-then-else structure
iii. Multiple Selection: Nested if or case structure
Example: Checking if a number is positive or negative.
3.3 Iteration Structure (Looping)
Definition: Repeating a set of steps while a condition is true.
Flowchart Representation: Flowline looping back to a previous point.
Types:
i. Pre-test Loop: Condition checked before execution (while loop)
ii. Post-test Loop: Condition checked after execution (do-while loop)
Example: Printing numbers from 1 to 10.