COMPROG LESON 1, 2, 3
COMPROG LESON 1, 2, 3
Flowcharting Guidelines:
1. A flowchart always begin with START and
is completed by END symbol
2. Selection/Conditional - The execution of
instructions by selection, wherein conditions
for a series of alternative statements are
evaluated to specify which instruction is to
be executed. In this way, the flow of the
program depends on the set of conditions
that are written.
LESSON 3
• Program Structures - are just a way to
specify flow of control in programs. Any
algorithm or program can be more clear and
understood if they use self-contained
modules called as logic or control structures.
It basically analyzes and chooses in which
direction a program flows based on certain
parameters or conditions. Basic types of
logic, or flow of control:
- Sequence logic, or
sequential flow
- Selection logic, or
conditional flow
- Iteration logic, or
repetitive flow
- Modular
1. Sequential - are performed in strictly
sequential manner, each step being executed
exactly once.
3. • Repetition/ Iteration /Loop Repetitive
/Iterative statements (loops) - allow a set
of instructions to be repeated or carried out
several times until certain conditions have
been met.
Two types: (1) count-controlled (2) condition –
controlled
✓ Count-controlled loop - The way the count-
controlled loop works is simple: the loop
holds a count of the number of times it runs,
and the loop stops when the count reaches
the specified count. 4. • Modular/Procedural - The approach is
sometimes called divide and conquer
because a large task is divided into several
This loop normally performs the following three smaller tasks that are easily performed.
actions:
Initialization : The control variable (counter) is
initialized to the starting value before the loop
starts.
Test : the loop terminating condition that checks
if looping should continue
Increment (or decrement)value by which the
control variable is modified at each iteration of
the loop.