Basic Structures

You might also like

Download as pptx, pdf, or txt
Download as pptx, pdf, or txt
You are on page 1of 10

THREE BASIC

STRUCTURES
REPORTERS:

BENTULAN, MARY IRENE O.


NOHARA, KRIZIA
SLIDESMANIA
Three Basic Structures

STRUCTURES
 A basic unit of programming logic
 to represent information about something more
complicated than a single number, character, or Boolean
can do.
SLIDESMANIA
THREE BASIC STRUCTURES
01 | SEQUENCE 02 | SELECTION 03 | LOOP
SLIDESMANIA
SEQUENCE
 start at the beginning and continue in sequential
order.

 This refers to the line-by-line execution, in which


statements are executed sequentially, in the same
order in which they appear in the script.
SLIDESMANIA
START

Enter Midterm score and


Final Score

EXAMPLE: sum=midterm + final score

Average score = sum/2

Display average score


SLIDESMANIA

END
SELECTION
 Also called a decision structure or an if-then-else
 Depending on whether a condition is true or false, the decision control structure may skip the
execution of an entire block of statements or even execute one block of statements instead of
another.
SLIDESMANIA
START
EXAMPLE:
READ TEMPERATURE

TEMP
FALSE TRUE
<32?

Display “BELOW Display “ABOVE


FREEZING” on the FREEZING” on the
screen screen
SLIDESMANIA

END
LOOP
 Also called repetition or iteration.

 structure which allows the execution of a block of statements multiple times until when the
specified condition is met.

TYPES OF LOOP
1. WHILE LOOP 2. FOR LOOP 3.DO-WHILE LOOP
the initial value is the condition is
a condition is evaluated performed only once, then always executed after
before processing a body the condition tests and the body of a loop. It
of the loop. If a condition is compares the counter to a is also called an exit-
true then and only then the fixed value after each controlled loop.
SLIDESMANIA

body of a loop is executed. iteration, stopping the for


loop when false is returned.
START

EXAMPLE: N=1

ENTER A NAME

DISPLAY A NAME

yes
END
N=20

no
SLIDESMANIA

N= n-1
THANK
YOU!!
SLIDESMANIA

You might also like