SlideShare a Scribd company logo
Logical Structures
Lecture 02
LOGICAL STRUCTURES
• There is a code running behind every software contain all sort of
terms and symbols. It can be break down into three simple
programming structures, which is called logical structures.
• Logical structures determine how your program will execute the
step by step process you have defined.
LOGICAL STRUCTURES
• One of the most important concepts of programming is the ability
to control a program so that different lines of code are executed
in proper way or that some lines of code are executed many times
for this Logical Structures are used.
• It basically analyzes and chooses in which direction a program
flows based on certain parameters or conditions.
LOGICAL STRUCTURES
• In computer programming there are three basic logical structures
that are widely used.
• Sequence
• Selection
• Loop
Sequence
• A sequence refers to a series of actions or steps that should be
followed one after another to complete a certain task to achieve a
goal.
• If we don’t put every step in the right sequence, the end result
isn’t what we wanted.
Sequence in Daily life
• Sequence applies in many aspects of our daily life. From simple
house chores to mathematic, if you want to solve a problem you
need to follow a certain set of actions in sequence.
• If you miss any of the steps of change the sequence the end result
can be different that what’s expected!
• Example:
• Have you ever planned a trip with your family or friends?
Sequence in Computer Science
• Sequence, the order that commands are executed by a computer,
allows us to carry out tasks that have multiple steps.
• A computer can only do what it is programmed to do. If the steps
are programmed in the wrong sequence, the computer will
perform the tasks in this sequence – even if this is incorrect.
Why Sequence?
• Proper sequence of coding gives proper working program.
• Machine understands proper sequence coding.
• It is important to follow sequencing to get desired
outcomes(softwares).
• In programming, computer can only carry out tasks that are in the
correct sequence. Computers are machines and they have to do
things the way they were built to do.
Example
• Do you know how to change a computer desktop background
image?
• Right click on your desktop and choose personalize.
• Select picture from the background list.
• Click a new picture for the background.
Example
Selection
• Selection are also known as conditions.
• Selections are a bit different and helps in
making decisions.
• Selection also called Conditionals are
expressions that evaluate to either true or
false. They are mostly used to determine
Program Flow through if statements.
Why Conditions?
• Conditions allow us to control what the program does and perform
different actions based on these "if, then" logic statements.
• What makes computer programs great is the ability to interact
with a user- this is only possible with conditions that direct this
type of interaction.
• Selection or condition help you in making decisions.
• Instead of following a specific order of events, they ask a question
in order to figure out which path to take next.
Conditions in Daily Life
• Conditions are part of our daily life.
• We question our self andmake decisions.
• If you are hungry -> you will eat food.
• If you are Thirsty -> You will drink water.
• If tomorrow is your exam -> you will study.
Conditions
LOOPS
• Loop means to repeat a same step for multiple
number of times to complete a tasks.
• It is also termed as Repetition or iteration.
• e.g:
• You can notice loops in nature. 4 seasons change and
repeat each year.
• walking, breathe, sleep
LOOP
LOOP
When programmers write code, This allows
them to write the code once and repeat it as
many times as needed, making it more likely for
the program to run as expected
Loops can be very useful and can save a lot of
time.
LOOP

More Related Content

PPTX
Computational thinking
PPTX
Algorithms and Programming
PPTX
COM1407: Structured Program Development
PPTX
Overview of Software Engineering Principles - SCPS311.pptx
PPTX
CPP11 - Function Design
PPT
Week-4-HCI.ppt are best notes for college students
PPTX
Software engineering topics,coding phase in sdlc
PPTX
Unit 2 CPR.pptxaccSSzzCSDVVSVZVZSVVSDVDDSDDS
Computational thinking
Algorithms and Programming
COM1407: Structured Program Development
Overview of Software Engineering Principles - SCPS311.pptx
CPP11 - Function Design
Week-4-HCI.ppt are best notes for college students
Software engineering topics,coding phase in sdlc
Unit 2 CPR.pptxaccSSzzCSDVVSVZVZSVVSDVDDSDDS

Similar to Understanding Logical Structures: Sequence, Selection, and Repetition (20)

PDF
Cse115 lecture03problemsolving
PPTX
INTROTOPROBLEMSOLVING.pptxINTROTOPROBLEMSOLVING.pptx
PPTX
Lesson 1 of c programming algorithms and flowcharts.pptx
PPT
Chapterunifiedmodelinglanguagetwouml2.ppt
PPT
PHP - Introduction to PHP Bugs - Debugging
PPTX
CPP01 - Introduction to C++
PDF
Algorithmic problem sloving
PPTX
SE Unit-1.pptx
PPTX
chapter _3.pptx Programming Language in DSS
PDF
Agile Software Development
PPTX
s-INTRODUCTION TO PROBLEM SOLVING PPT.pptx
PPTX
classVII_Coding_Teacher_Presentation.pptx
PPTX
PROBLEM SOLVING.pptx
PPTX
Types of Operating System
PPTX
COMPUTING AND PROGRAMMING FUNDAMENTAL.pptx
PPTX
COMPUTING AND PROGRAMMING FUNDAMENTAL.pptx
PPTX
c++ approach of using object oriented programming
PPT
Problem solving
PPTX
{10.0} Test Driven Development.pptx
PPTX
COMPUTER 10 QUARTER 1 LESSON 1 K12 LESSON
Cse115 lecture03problemsolving
INTROTOPROBLEMSOLVING.pptxINTROTOPROBLEMSOLVING.pptx
Lesson 1 of c programming algorithms and flowcharts.pptx
Chapterunifiedmodelinglanguagetwouml2.ppt
PHP - Introduction to PHP Bugs - Debugging
CPP01 - Introduction to C++
Algorithmic problem sloving
SE Unit-1.pptx
chapter _3.pptx Programming Language in DSS
Agile Software Development
s-INTRODUCTION TO PROBLEM SOLVING PPT.pptx
classVII_Coding_Teacher_Presentation.pptx
PROBLEM SOLVING.pptx
Types of Operating System
COMPUTING AND PROGRAMMING FUNDAMENTAL.pptx
COMPUTING AND PROGRAMMING FUNDAMENTAL.pptx
c++ approach of using object oriented programming
Problem solving
{10.0} Test Driven Development.pptx
COMPUTER 10 QUARTER 1 LESSON 1 K12 LESSON
Ad

More from Ismail Hussain (10)

PPTX
Exploring Forms of Business Organization: A Complete Guide
PPTX
Understanding the Basics of Entrepreneurship
PPTX
Algorithm (Basic Algorithm Presentation).pptx
PPTX
Logical Structures
PPTX
Computer Vision Presentation
PPTX
Understanding Artificial Intelligence: Concepts, Applications, and Future Trends
PPTX
Branding Strategy in Marketing
PPTX
Software Testing Technique in Software Engineering
PPTX
Understanding Real GDP: Measurement, Importance, and Economic Impacts
PPTX
Generation of computer
Exploring Forms of Business Organization: A Complete Guide
Understanding the Basics of Entrepreneurship
Algorithm (Basic Algorithm Presentation).pptx
Logical Structures
Computer Vision Presentation
Understanding Artificial Intelligence: Concepts, Applications, and Future Trends
Branding Strategy in Marketing
Software Testing Technique in Software Engineering
Understanding Real GDP: Measurement, Importance, and Economic Impacts
Generation of computer
Ad

Recently uploaded (20)

PDF
Computing-Curriculum for Schools in Ghana
PDF
Physiotherapy_for_Respiratory_and_Cardiac_Problems WEBBER.pdf
PDF
Black Hat USA 2025 - Micro ICS Summit - ICS/OT Threat Landscape
PDF
Saundersa Comprehensive Review for the NCLEX-RN Examination.pdf
PDF
Basic Mud Logging Guide for educational purpose
PPTX
Introduction_to_Human_Anatomy_and_Physiology_for_B.Pharm.pptx
PPTX
school management -TNTEU- B.Ed., Semester II Unit 1.pptx
PDF
Microbial disease of the cardiovascular and lymphatic systems
PDF
Insiders guide to clinical Medicine.pdf
PDF
Complications of Minimal Access Surgery at WLH
PDF
RMMM.pdf make it easy to upload and study
PPTX
Renaissance Architecture: A Journey from Faith to Humanism
PDF
Sports Quiz easy sports quiz sports quiz
PDF
Abdominal Access Techniques with Prof. Dr. R K Mishra
PDF
O5-L3 Freight Transport Ops (International) V1.pdf
PDF
102 student loan defaulters named and shamed – Is someone you know on the list?
PPTX
Cell Structure & Organelles in detailed.
PDF
STATICS OF THE RIGID BODIES Hibbelers.pdf
PDF
01-Introduction-to-Information-Management.pdf
PDF
Supply Chain Operations Speaking Notes -ICLT Program
Computing-Curriculum for Schools in Ghana
Physiotherapy_for_Respiratory_and_Cardiac_Problems WEBBER.pdf
Black Hat USA 2025 - Micro ICS Summit - ICS/OT Threat Landscape
Saundersa Comprehensive Review for the NCLEX-RN Examination.pdf
Basic Mud Logging Guide for educational purpose
Introduction_to_Human_Anatomy_and_Physiology_for_B.Pharm.pptx
school management -TNTEU- B.Ed., Semester II Unit 1.pptx
Microbial disease of the cardiovascular and lymphatic systems
Insiders guide to clinical Medicine.pdf
Complications of Minimal Access Surgery at WLH
RMMM.pdf make it easy to upload and study
Renaissance Architecture: A Journey from Faith to Humanism
Sports Quiz easy sports quiz sports quiz
Abdominal Access Techniques with Prof. Dr. R K Mishra
O5-L3 Freight Transport Ops (International) V1.pdf
102 student loan defaulters named and shamed – Is someone you know on the list?
Cell Structure & Organelles in detailed.
STATICS OF THE RIGID BODIES Hibbelers.pdf
01-Introduction-to-Information-Management.pdf
Supply Chain Operations Speaking Notes -ICLT Program

Understanding Logical Structures: Sequence, Selection, and Repetition

  • 2. LOGICAL STRUCTURES • There is a code running behind every software contain all sort of terms and symbols. It can be break down into three simple programming structures, which is called logical structures. • Logical structures determine how your program will execute the step by step process you have defined.
  • 3. LOGICAL STRUCTURES • One of the most important concepts of programming is the ability to control a program so that different lines of code are executed in proper way or that some lines of code are executed many times for this Logical Structures are used. • It basically analyzes and chooses in which direction a program flows based on certain parameters or conditions.
  • 4. LOGICAL STRUCTURES • In computer programming there are three basic logical structures that are widely used. • Sequence • Selection • Loop
  • 5. Sequence • A sequence refers to a series of actions or steps that should be followed one after another to complete a certain task to achieve a goal. • If we don’t put every step in the right sequence, the end result isn’t what we wanted.
  • 6. Sequence in Daily life • Sequence applies in many aspects of our daily life. From simple house chores to mathematic, if you want to solve a problem you need to follow a certain set of actions in sequence. • If you miss any of the steps of change the sequence the end result can be different that what’s expected! • Example: • Have you ever planned a trip with your family or friends?
  • 7. Sequence in Computer Science • Sequence, the order that commands are executed by a computer, allows us to carry out tasks that have multiple steps. • A computer can only do what it is programmed to do. If the steps are programmed in the wrong sequence, the computer will perform the tasks in this sequence – even if this is incorrect.
  • 8. Why Sequence? • Proper sequence of coding gives proper working program. • Machine understands proper sequence coding. • It is important to follow sequencing to get desired outcomes(softwares). • In programming, computer can only carry out tasks that are in the correct sequence. Computers are machines and they have to do things the way they were built to do.
  • 9. Example • Do you know how to change a computer desktop background image? • Right click on your desktop and choose personalize. • Select picture from the background list. • Click a new picture for the background.
  • 11. Selection • Selection are also known as conditions. • Selections are a bit different and helps in making decisions. • Selection also called Conditionals are expressions that evaluate to either true or false. They are mostly used to determine Program Flow through if statements.
  • 12. Why Conditions? • Conditions allow us to control what the program does and perform different actions based on these "if, then" logic statements. • What makes computer programs great is the ability to interact with a user- this is only possible with conditions that direct this type of interaction. • Selection or condition help you in making decisions. • Instead of following a specific order of events, they ask a question in order to figure out which path to take next.
  • 13. Conditions in Daily Life • Conditions are part of our daily life. • We question our self andmake decisions. • If you are hungry -> you will eat food. • If you are Thirsty -> You will drink water. • If tomorrow is your exam -> you will study.
  • 15. LOOPS • Loop means to repeat a same step for multiple number of times to complete a tasks. • It is also termed as Repetition or iteration. • e.g: • You can notice loops in nature. 4 seasons change and repeat each year. • walking, breathe, sleep
  • 16. LOOP
  • 17. LOOP When programmers write code, This allows them to write the code once and repeat it as many times as needed, making it more likely for the program to run as expected Loops can be very useful and can save a lot of time.
  • 18. LOOP