SlideShare a Scribd company logo
pseudocode and Flowchart
What is pseudocode?
 List of steps written in English
 Like the instructions for a recipe
 Must be in the right sequence
 Imagine saying “bake the cake” and then “mix it up”
Sample Pseudocode
 Task: add two numbers
 Pseudocode:
 Start
 Get two numbers
 Get first number
 Get second number
 Add them
 Print the answer
 End
Invitation to Computer Science,
Java Version, Third Edition 4
Pseudocode
 English language constructs modeled to look like
statements available in most programming
languages
 Steps presented in a structured manner
(numbered, indented, and so on)
 No fixed syntax for most operations is required
Invitation to Computer Science,
Java Version, Third Edition 5
Pseudocode (continued)
 Less ambiguous and more readable than natural
language
 Emphasis is on process, not notation
 Well-understood forms allow logical reasoning
about algorithm behavior
 Can be easily translated into a programming
language
Sample Pseudocode
 Task: add two numbers
 Pseudocode:
 Start
 Get two numbers
 Get first number
 Get second number
 Add them
 Print the answer
 End
What does a flowchart look like?
 The pseudocode from the previous slide would look
like this as a flowchart:
Start
Get 2 numbers
Add them
Print answer
End
What are those funny symbols?
 START/END
 INPUT/OUTPUT
 PROCESS
 DECISION
What are those funny symbols?
 START/END
 Used at the beginning
and end of each
flowchart.
 INPUT/OUTPUT
 Shows when
information/data comes
into a program or is
printed out.
What are those funny symbols?
What are those funny symbols?
 PROCESS
 Used to show
calculations, storing of
data in variables, and
other “processes” that
take place within a
program.
What are those funny symbols?
What are those funny symbols?
 DECISION
 Used to show that the
program must decide
whether something
(usually a comparison
between numbers) is
true or false. YES and
NO (or T/F) branches
are usually shown.
What are those funny symbols?
Y
N
X>7?
Another Sample:
Calculating Age
 Pseudocode:
 Start
 Get year DOB
 Calculate age = (sysdate-DOB)
 Print age
 If age > 50 print OLD
 End
Another Sample:
Calculating Age
 Flowchart
 Start
 Get year born
 Calculate age
 Print age
 If age > 50 print OLD
 End
Get yr
Calc age
Print age
Age>50?OLD Y
N
Start
End
Self-Check
 Look at the flowchart section below. If the variable X is
5, what will print (K or 1st)?
X > 5?
YN
Print “1st”Print “K”
Self-Check
 Look at the flowchart section below. If the variable X is
5, what will print (K or 1st)?
X > 5?
YN
Print “1st”Print “K”
K will be printed. The answer to the question “Is X greater than 5?”
is NO, since X is equal to (not greater than) 5.
Self-Check
 Choose the correct
flowchart symbol for each
of these statements.
 AGE>65?
 Calc. Tax
 START
 Print NAME
Self-Check
 Choose the correct
flowchart symbol for each
of these statements.
 AGE>65?
 Calc. Tax
 START
 Print NAME
Challenge
 Try to write pseudocode and create a flowchart for a
program that calculates the average of three grades
and prints the average.
 The word GOOD should be printed only if the average
is more than 80.
Challenge
 Possible pseudocode
 Start
 Get three grades
 Average them (add all of them / number of grads taken)
 Print Average
 Average>80?
 If Yes, print GOOD
 End
Challenge
 Possible flowchart
 Start
 Get three grades
 Average them
 Print Average
 Average>80?
 If Yes, print GOOD
 End
START
END
Get 3 grades
Calc avg
Print avg
Avg>80?GOOD
Y
N
Challenge
 Try to write pseudocode and create a flowchart for a
program that calculates the average of three grades
and prints the average.
 The word GOOD should be printed only if the average
is more than 80.
Challenge
 Possible pseudocode
 Start
 Get three grades
 Average them
 Print Average
 Average>80?
 If Yes, print GOOD
 End
Challenge
 Possible flowchart
 Start
 Get three grades
 Average them
 Print Average
 Average>80?
 If Yes, print GOOD
 End
START
END
Get 3 grades
Calc avg
Print avg
Avg>80?GOOD
Y
N
pseudocode and Flowchart
 Algorithm for Computing Average Miles per
Gallon
pseudocode and Flowchart
 Write a program to do the task: Print a list of the numbers
from 4 to 9, next to each number, print the square of the
number.
pseudocode and Flowchart
pseudocode and Flowchart

More Related Content

PDF
Pseudocode & flowchart examples
PPTX
Pseudocode
PPT
pseudo code basics
PPTX
Algorithm and pseudo codes
PPTX
Algorithm and flowchart
PPTX
Programming process and flowchart
PPTX
Flowchart and algorithm
PDF
Pseudocode By ZAK
Pseudocode & flowchart examples
Pseudocode
pseudo code basics
Algorithm and pseudo codes
Algorithm and flowchart
Programming process and flowchart
Flowchart and algorithm
Pseudocode By ZAK

What's hot (20)

PPTX
Programming Fundamentals
PDF
Visual Basic IDE Introduction
PPTX
Dbms slides
PDF
SPL 2 | Algorithms, Pseudo-code, and Flowchart
PPTX
Lecture 1 introduction to vb.net
PPTX
Tree Traversal
PPTX
Operators in java
PPT
Program design and problem solving techniques
PPTX
Introduction to flowchart
PPTX
Introduction to data structure ppt
PPTX
Pseudocode
PPTX
introduction to visual basic PPT.pptx
PDF
Visual Basic 6.0
PPTX
GRADE 6 ALGORITHM.pptx
PPT
MS Word Basics Training
PPTX
What is an algorithm?
PPT
Swing and AWT in java
PPT
Visual programming lecture
PPTX
Breadth First Search & Depth First Search
PPT
Lecture 1 - Lexical Analysis.ppt
Programming Fundamentals
Visual Basic IDE Introduction
Dbms slides
SPL 2 | Algorithms, Pseudo-code, and Flowchart
Lecture 1 introduction to vb.net
Tree Traversal
Operators in java
Program design and problem solving techniques
Introduction to flowchart
Introduction to data structure ppt
Pseudocode
introduction to visual basic PPT.pptx
Visual Basic 6.0
GRADE 6 ALGORITHM.pptx
MS Word Basics Training
What is an algorithm?
Swing and AWT in java
Visual programming lecture
Breadth First Search & Depth First Search
Lecture 1 - Lexical Analysis.ppt
Ad

Similar to pseudocode and Flowchart (20)

PPTX
Programming fundamentals lecture 3
PPT
Programming
PPT
programming.ppt
PPT
Fundamentals of Programming Chapter 3
PPT
Learn Programming with Livecoding.tv http://goo.gl/tIgO1I
PPT
3 algorithm-and-flowchart
PPT
BCE L-2 Algorithms-and-Flowchart-ppt.ppt
PPT
Lecture_01-Problem_Solving[1]||ProgrammingFundamental.ppt
PPT
Algorithmsandflowcharts1
PPT
Algorithmsandflowcharts1
PPT
Algorithms and Flowchart.ppt
PPT
01 Algorithms And Flowcharts.ppt
PPTX
Algorithms and Flowcharts
PDF
algorithms and flow chart overview.pdf
PPT
Algorithms and Flowchart for IGCSE Students
PDF
ICP - Lecture 6
PPTX
Algorithmsandflowcharts1
PDF
Introduction to programming : flowchart, algorithm
PPTX
pseudocode Note(IGCSE Computer Sciences)
PPTX
Lec-ProblemSolving.pptx
Programming fundamentals lecture 3
Programming
programming.ppt
Fundamentals of Programming Chapter 3
Learn Programming with Livecoding.tv http://goo.gl/tIgO1I
3 algorithm-and-flowchart
BCE L-2 Algorithms-and-Flowchart-ppt.ppt
Lecture_01-Problem_Solving[1]||ProgrammingFundamental.ppt
Algorithmsandflowcharts1
Algorithmsandflowcharts1
Algorithms and Flowchart.ppt
01 Algorithms And Flowcharts.ppt
Algorithms and Flowcharts
algorithms and flow chart overview.pdf
Algorithms and Flowchart for IGCSE Students
ICP - Lecture 6
Algorithmsandflowcharts1
Introduction to programming : flowchart, algorithm
pseudocode Note(IGCSE Computer Sciences)
Lec-ProblemSolving.pptx
Ad

More from ALI RAZA (20)

PPTX
Structure
PPTX
Recursion
PPTX
Algorithm Development
PPT
Programming Fundamentals using C++
PPTX
Introduction to Programming
PPTX
Introduction to Programming
PPTX
Array sorting
PPTX
Array programs
PPTX
2D-Array
DOCX
Quiz game documentary
PPTX
Function pass by value,function pass by reference
PPTX
Drug Addiction 39 Slides
PPTX
Drug Addiction Original 51 Slides
PPTX
Passing stuctures to function
PDF
Basic general knowledge
PDF
Dil hua kirchi kirchi by mohammad iqbal shams
PDF
Pathar kar-do-ankh-mein-ansu-complete
PDF
Husne akhlaq
PDF
Parts of speech sticky note definitions and examples
PDF
Quik tips
Structure
Recursion
Algorithm Development
Programming Fundamentals using C++
Introduction to Programming
Introduction to Programming
Array sorting
Array programs
2D-Array
Quiz game documentary
Function pass by value,function pass by reference
Drug Addiction 39 Slides
Drug Addiction Original 51 Slides
Passing stuctures to function
Basic general knowledge
Dil hua kirchi kirchi by mohammad iqbal shams
Pathar kar-do-ankh-mein-ansu-complete
Husne akhlaq
Parts of speech sticky note definitions and examples
Quik tips

Recently uploaded (20)

PPTX
Nursing Management of Patients with Disorders of Ear, Nose, and Throat (ENT) ...
DOCX
UPPER GASTRO INTESTINAL DISORDER.docx
PDF
Mga Unang Hakbang Tungo Sa Tao by Joe Vibar Nero.pdf
PPTX
COMPUTERS AS DATA ANALYSIS IN PRECLINICAL DEVELOPMENT.pptx
PPTX
Introduction_to_Human_Anatomy_and_Physiology_for_B.Pharm.pptx
PDF
Physiotherapy_for_Respiratory_and_Cardiac_Problems WEBBER.pdf
PDF
Piense y hagase Rico - Napoleon Hill Ccesa007.pdf
PPTX
Renaissance Architecture: A Journey from Faith to Humanism
PDF
Abdominal Access Techniques with Prof. Dr. R K Mishra
PDF
BÀI TẬP BỔ TRỢ 4 KỸ NĂNG TIẾNG ANH 9 GLOBAL SUCCESS - CẢ NĂM - BÁM SÁT FORM Đ...
PDF
The Lost Whites of Pakistan by Jahanzaib Mughal.pdf
PDF
From loneliness to social connection charting
PPTX
How to Manage Starshipit in Odoo 18 - Odoo Slides
PPTX
human mycosis Human fungal infections are called human mycosis..pptx
PPTX
Cardiovascular Pharmacology for pharmacy students.pptx
PDF
Business Ethics Teaching Materials for college
PPTX
Onica Farming 24rsclub profitable farm business
PDF
Saundersa Comprehensive Review for the NCLEX-RN Examination.pdf
PDF
Pre independence Education in Inndia.pdf
PPTX
Pharmacology of Heart Failure /Pharmacotherapy of CHF
Nursing Management of Patients with Disorders of Ear, Nose, and Throat (ENT) ...
UPPER GASTRO INTESTINAL DISORDER.docx
Mga Unang Hakbang Tungo Sa Tao by Joe Vibar Nero.pdf
COMPUTERS AS DATA ANALYSIS IN PRECLINICAL DEVELOPMENT.pptx
Introduction_to_Human_Anatomy_and_Physiology_for_B.Pharm.pptx
Physiotherapy_for_Respiratory_and_Cardiac_Problems WEBBER.pdf
Piense y hagase Rico - Napoleon Hill Ccesa007.pdf
Renaissance Architecture: A Journey from Faith to Humanism
Abdominal Access Techniques with Prof. Dr. R K Mishra
BÀI TẬP BỔ TRỢ 4 KỸ NĂNG TIẾNG ANH 9 GLOBAL SUCCESS - CẢ NĂM - BÁM SÁT FORM Đ...
The Lost Whites of Pakistan by Jahanzaib Mughal.pdf
From loneliness to social connection charting
How to Manage Starshipit in Odoo 18 - Odoo Slides
human mycosis Human fungal infections are called human mycosis..pptx
Cardiovascular Pharmacology for pharmacy students.pptx
Business Ethics Teaching Materials for college
Onica Farming 24rsclub profitable farm business
Saundersa Comprehensive Review for the NCLEX-RN Examination.pdf
Pre independence Education in Inndia.pdf
Pharmacology of Heart Failure /Pharmacotherapy of CHF

pseudocode and Flowchart

  • 2. What is pseudocode?  List of steps written in English  Like the instructions for a recipe  Must be in the right sequence  Imagine saying “bake the cake” and then “mix it up”
  • 3. Sample Pseudocode  Task: add two numbers  Pseudocode:  Start  Get two numbers  Get first number  Get second number  Add them  Print the answer  End
  • 4. Invitation to Computer Science, Java Version, Third Edition 4 Pseudocode  English language constructs modeled to look like statements available in most programming languages  Steps presented in a structured manner (numbered, indented, and so on)  No fixed syntax for most operations is required
  • 5. Invitation to Computer Science, Java Version, Third Edition 5 Pseudocode (continued)  Less ambiguous and more readable than natural language  Emphasis is on process, not notation  Well-understood forms allow logical reasoning about algorithm behavior  Can be easily translated into a programming language
  • 6. Sample Pseudocode  Task: add two numbers  Pseudocode:  Start  Get two numbers  Get first number  Get second number  Add them  Print the answer  End
  • 7. What does a flowchart look like?  The pseudocode from the previous slide would look like this as a flowchart: Start Get 2 numbers Add them Print answer End
  • 8. What are those funny symbols?  START/END  INPUT/OUTPUT  PROCESS  DECISION
  • 9. What are those funny symbols?  START/END  Used at the beginning and end of each flowchart.
  • 10.  INPUT/OUTPUT  Shows when information/data comes into a program or is printed out. What are those funny symbols?
  • 11. What are those funny symbols?  PROCESS  Used to show calculations, storing of data in variables, and other “processes” that take place within a program. What are those funny symbols?
  • 12. What are those funny symbols?  DECISION  Used to show that the program must decide whether something (usually a comparison between numbers) is true or false. YES and NO (or T/F) branches are usually shown. What are those funny symbols? Y N X>7?
  • 13. Another Sample: Calculating Age  Pseudocode:  Start  Get year DOB  Calculate age = (sysdate-DOB)  Print age  If age > 50 print OLD  End
  • 14. Another Sample: Calculating Age  Flowchart  Start  Get year born  Calculate age  Print age  If age > 50 print OLD  End Get yr Calc age Print age Age>50?OLD Y N Start End
  • 15. Self-Check  Look at the flowchart section below. If the variable X is 5, what will print (K or 1st)? X > 5? YN Print “1st”Print “K”
  • 16. Self-Check  Look at the flowchart section below. If the variable X is 5, what will print (K or 1st)? X > 5? YN Print “1st”Print “K” K will be printed. The answer to the question “Is X greater than 5?” is NO, since X is equal to (not greater than) 5.
  • 17. Self-Check  Choose the correct flowchart symbol for each of these statements.  AGE>65?  Calc. Tax  START  Print NAME
  • 18. Self-Check  Choose the correct flowchart symbol for each of these statements.  AGE>65?  Calc. Tax  START  Print NAME
  • 19. Challenge  Try to write pseudocode and create a flowchart for a program that calculates the average of three grades and prints the average.  The word GOOD should be printed only if the average is more than 80.
  • 20. Challenge  Possible pseudocode  Start  Get three grades  Average them (add all of them / number of grads taken)  Print Average  Average>80?  If Yes, print GOOD  End
  • 21. Challenge  Possible flowchart  Start  Get three grades  Average them  Print Average  Average>80?  If Yes, print GOOD  End START END Get 3 grades Calc avg Print avg Avg>80?GOOD Y N
  • 22. Challenge  Try to write pseudocode and create a flowchart for a program that calculates the average of three grades and prints the average.  The word GOOD should be printed only if the average is more than 80.
  • 23. Challenge  Possible pseudocode  Start  Get three grades  Average them  Print Average  Average>80?  If Yes, print GOOD  End
  • 24. Challenge  Possible flowchart  Start  Get three grades  Average them  Print Average  Average>80?  If Yes, print GOOD  End START END Get 3 grades Calc avg Print avg Avg>80?GOOD Y N
  • 26.  Algorithm for Computing Average Miles per Gallon
  • 28.  Write a program to do the task: Print a list of the numbers from 4 to 9, next to each number, print the square of the number.