SlideShare a Scribd company logo
Computer Programming 1 – Information
Technology
CMO 25 s. 2015
Recap
 A brief history of women in Software Engineering
Pseudocode
 What is pseudocode
 What is algorithm
 Advantages of pseudocode
 How to write pseudocode
 Pseudocode Flow of control
Specific Objectives
By the end of this lesson, you should
1. Write pseudo code for a given problem
2. Display teamwork in completing task
3. Cooperate in group work
What is pseudocode?
is a detailed yet readable
description of what a computer
program or algorithm must do,
expressed in a formally-styled
natural language rather than in
a programming language.
Pseudocode is sometimes used
as a detailed step in
the process of developing a
program.
Application of pseudocode
Textbooks and scientific publications related to computer
science and numerical computation often use pseudocode in
description of algorithms, so that all programmers can
understand them, even if they do not all know the same
programming languages.
A programmer who needs to implement a specific algorithm,
especially an unfamiliar one, will often start with a
pseudocode description, and then "translate" that description
into the target programming language and modify it to
interact correctly with the rest of the program.
Syntax of pseudocode
As the name suggests, pseudocode generally does not actually
obey the syntax rules of any particular language; there is no
systematic standard form, although any particular writer will
generally borrow style and syntax; for example, control
structures from some conventional programming language.
What is algorithm?
Algorithm: It’s an organized logical sequence of the actions or
the approach towards a particular problem. A programmer
implements an algorithm to solve a problem in a specific
programming language.
Pseudo code: It’s simply an implementation of an algorithm in
the form of annotations and informative text written in plain
English. It has no syntax like any of the programming language
and thus can’t be compiled or interpreted by the computer.
Advantages of pseudocode
 Improves the readability of any approach. It’s one of the
best approaches to start implementation of an algorithm.
 Acts as a bridge between the program and the algorithm or
flowchart. Also works as a rough documentation, so the
program of one developer can be understood easily when a
pseudo code is written out. In industries, the approach of
documentation is essential. And that’s where a pseudo-code
proves vital.
 The main goal of a pseudo code is to explain what exactly
each line of a program should do, hence making the code
construction phase easier for the programmer.
RULES FOR PSEUDOCODE
1. Write only one statement per line
2. Capitalize initial keyword
3. Indent to show hierarchy
4. End multiline structures
5. Keep statements language independent
RULES FOR PSEUDOCODE
1. Write only one
statement per line
Each statement in
your pseudocode
should express just
one action for the
computer. If the task
list is properly drawn,
then in most cases
each task will
correspond to one line
of pseudocode.
1
2
3
4
5
RULES FOR PSEUDOCODE
2. Capitalize initial keyword
In the example above, READ
and WRITE are in caps. There
are just a few keywords we
will use:
READ, WRITE, IF, ELSE, ENDIF,
WHILE, ENDWHILE, REPEAT,
UNTIL
Input: READ, OBTAIN, GET
Output: PRINT, DISPLAY, SHOW
Compute: COMPUTE,
CALCULATE, DETERMINE
Initialize: SET, INIT
Add one: INCREMENT, BUMP
RULES FOR PSEUDOCODE
3. Indent to show
hierarchy
We will use a particular
indentation pattern in each of
the design structures:
SEQUENCE: keep statements
that are “stacked” in sequence
all starting in the same column.
SELECTION: indent the
statements that fall inside the
selection structure, but not the
keywords that form the selection
LOOPING: indent the statements
that fall inside the loop, but not
the keywords that form the loop
RULES FOR PSEUDOCODE
4. End multiline
structures
See how the
IF/ELSE/ENDIF is
constructed above.
The ENDIF (or END
whatever) always is in
line with the IF (or
whatever starts the
structure).
RULES FOR PSEUDOCODE
5. Keep staments language independent
Resist the urge to write in whatever language you are most
comfortable with. In the long run, you will save time! There
may be special features available in the language you plan to
eventually write the program in; if you are SURE it will be
written in that language, then you can use the features. If not,
then avoid using the special features.
Format
ProgramName ComputerSumofTwoNumbers:
BEGIN
DECLARE num1, num2, sum
READ num1, num2
sum is equals to num1 + num2 or sum = num1
+num2
WRITE total
END
Exercises
1. Create a pseudocode that will compute and display the area of a rectangle
2. Create a pseudocode of the activities that you do when you get up in the morning
3. Create a pseudocode on how to cook a noodles
4. Create a pseudocode on how to compute your age
5. Create a pseudocode on how to computer your grades in highschool
6. Create a pseudocode on how to withdraw money from ATM
7. Create a pseudocode that will computer the sum of 5 numbers and then display the average.
8. Write pseudocode that will compute your salary based on the basic formula (salary = (number of days work * rate per
day) – deduction)
9. Write a java program that will compute the number of respondents using the sloven’s formula. To compute the
number of respondents the user must enter the total population size.
Sloven’s formula:
n = N/(1+(Ne2))
where:
n = number of respondents
N = total population
e = margin of error , 0.05 in this case
Flow of Control
Sequential flow
Selection or Conditional flow
Iterative flow
2. Pseudocode 2. Pseudocode2. Pseudocode2. Pseudocode.pptx
Selection or Conditional Flow
During algorithm development, we need statements which
evaluate expressions and execute instructions depending on
whether the expression evaluated to True or False.
IF — ELSE IF — ELSE
This is a conditional that is used to provide statements to be
executed if a certain condition is met. This also applies to
multiple conditions and different variables.
Types of Selection
Single Alternative (if statement)
Double Alternative (if else statement)
Multiple Alternative (if else if statement)
2. Pseudocode 2. Pseudocode2. Pseudocode2. Pseudocode.pptx
2. Pseudocode 2. Pseudocode2. Pseudocode2. Pseudocode.pptx
2. Pseudocode 2. Pseudocode2. Pseudocode2. Pseudocode.pptx
Basic Math Symbols
 When we have to make a
choice between actions,
we almost always base
that choice on a test.
The test uses phrases like
“is less than” or “is equal
to”. There is a
universally accepted set
of symbols used to
represent these phrases:
Logical Operators
AND: if any of the conditions
are false, the whole expression
is false.
IF day = “Saturday” AND weather = “sunny”
WRITE “Let’s go to the beach!”
ENDIF
OR: if any of the conditions are
true, the whole expression is
true
IF month = “June” OR month = “July” OR
month = “August”
WRITE “Yahoo! Summer vacation!”
ENDIF
NOT: reverses the outcome of
the expression; true becomes
false, false becomes true.
IF day <> “Saturday” AND day <> “Sunday”
WRITE “Yuk, another work day”
ENDIF
Single Alternative (if statement)
Double Alternative (if else statement)
Multiple Alternative (if else if statement)
Nested if statement
Nested If...Then...
Else statements te
st for multiple
conditions by
placing If...Then...
Else statements ins
ide other If...Then.
..Else statements.
2. Pseudocode 2. Pseudocode2. Pseudocode2. Pseudocode.pptx
2. Pseudocode 2. Pseudocode2. Pseudocode2. Pseudocode.pptx
Exercises
1. Write a pseudocode that will determine if the number is an odd or even number
2. Write a pseudocode that will print passed if the grade is above 74, failed if 74 and below
3. Write a pseudocde that will determine the highest number between two numbers.
4. Write a pseudocde that converts currency to another currency. It is a peso to dollar, dollar to peso converter program. The final
result will be the converted amount of the currency.
5. Write a pseudocde that will ask the user to enter 1-10 and call that program as PrintNumberInWord which prints "ONE", "TWO",... ,
"NINE", "OTHER" if the int variable "number" is 1, 2,... , 9, or other, respectively. Use (a) a "if.elseif.else" statement
6. Write a java program that will ask the user to enter 2 numbers and will ask what operator to use (1 for addition, 2 for subtraction, 3
for division, and 4 for multiplication). It will also print the result.
7. ATM Machine Pseudocode. Suppose you have a balance of 5000 pesos, create a java program that will ask the user to select the
transaction he/she want to access, w to withdraw (ask the user to input amount to withdraw and output the new balance), d for
deposit (ask the user to input amount to deposit and output the new balance), i for inquiry (display the balance).
8. Writea a pseudocode that will ask the user to enter its grade then display the remarks.
95-100 - excellent
90-94 - very good
85-89 - good
80-84- satisfactory
76-79 - study harder
75 - passed
74 below – failed
Iterative Flow
To iterate is to repeat a set of instructions in
order to generate a sequence of outcomes. We
iterate so that we can achieve a certain goal.
Types of Iteration
for loop
while loop
do-while loop
2. Pseudocode 2. Pseudocode2. Pseudocode2. Pseudocode.pptx
Assessment
By the end of this lesson, you should
1. Write pseudo code for a given problem – Quiz and
Exercises
2. Display teamwork in completing task – Project and
Reporting
3. Cooperate in group work - Project and Reporting
2. Pseudocode 2. Pseudocode2. Pseudocode2. Pseudocode.pptx
Thank you!
Questions?
Reactions?
Suggestions?

More Related Content

PPTX
Introduction to Pseudocode
PPTX
Pseudocode
PPT
pseudo code basics
PPTX
Cs1123 2 comp_prog
PPTX
vingautosaved-230525024624-6a6fb3b2.pptx
PPTX
Algorithm Design and Problem Solving [Autosaved].pptx
PPTX
pseudocode Note(IGCSE Computer Sciences)
PPT
Programming
Introduction to Pseudocode
Pseudocode
pseudo code basics
Cs1123 2 comp_prog
vingautosaved-230525024624-6a6fb3b2.pptx
Algorithm Design and Problem Solving [Autosaved].pptx
pseudocode Note(IGCSE Computer Sciences)
Programming

Similar to 2. Pseudocode 2. Pseudocode2. Pseudocode2. Pseudocode.pptx (20)

PPTX
Algorithm and pseudo codes
PPT
Learn Programming with Livecoding.tv http://goo.gl/tIgO1I
PPT
programming language(C++) chapter-one contd.ppt
PPT
programming.ppt
PPT
PPTX
INTROTOPROBLEMSOLVING.pptxINTROTOPROBLEMSOLVING.pptx
PPTX
Lec-ProblemSolving.pptx
PPSX
Ds02 flow chart and pseudo code
PDF
Introduction to programming : flowchart, algorithm
PPTX
s-INTRODUCTION TO PROBLEM SOLVING PPT.pptx
PPT
Fundamentals of Programming Chapter 3
PDF
ICP - Lecture 6
PPTX
Unit 1 c programming language Tut and notes
PPTX
Fundamentals of Programming Lecture #1.pptx
PPT
Data Structures- Part1 overview and review
PDF
Pseudocode By ZAK
PDF
LEC 5 [CS 101] Introduction to computer science.pdf
PPT
Chapter 5( programming) answer
PPT
3 algorithm-and-flowchart
PPT
Proble, Solving & Automation
Algorithm and pseudo codes
Learn Programming with Livecoding.tv http://goo.gl/tIgO1I
programming language(C++) chapter-one contd.ppt
programming.ppt
INTROTOPROBLEMSOLVING.pptxINTROTOPROBLEMSOLVING.pptx
Lec-ProblemSolving.pptx
Ds02 flow chart and pseudo code
Introduction to programming : flowchart, algorithm
s-INTRODUCTION TO PROBLEM SOLVING PPT.pptx
Fundamentals of Programming Chapter 3
ICP - Lecture 6
Unit 1 c programming language Tut and notes
Fundamentals of Programming Lecture #1.pptx
Data Structures- Part1 overview and review
Pseudocode By ZAK
LEC 5 [CS 101] Introduction to computer science.pdf
Chapter 5( programming) answer
3 algorithm-and-flowchart
Proble, Solving & Automation
Ad

More from bonakiduza1024 (6)

PPTX
1. Introduction to Computer Programming.pptx
PPTX
2. Women in Software Engineering 2. Women in Software Engineering.pptx
PPTX
SDLC SDLC SDLC SDLC SDLC SDLC SDLC .pptx
PPTX
TechTalks-8-2019-Service-Management-ITIL-Refresh-ITIL-4-Framework-Supports-Ou...
PPTX
Module1-Part 2 Module1-Part 2Module1-Part 2.pptx
PPTX
MODULE 1 MODULE 1MODULE 1MODULE 1MODULE 1.pptx
1. Introduction to Computer Programming.pptx
2. Women in Software Engineering 2. Women in Software Engineering.pptx
SDLC SDLC SDLC SDLC SDLC SDLC SDLC .pptx
TechTalks-8-2019-Service-Management-ITIL-Refresh-ITIL-4-Framework-Supports-Ou...
Module1-Part 2 Module1-Part 2Module1-Part 2.pptx
MODULE 1 MODULE 1MODULE 1MODULE 1MODULE 1.pptx
Ad

Recently uploaded (20)

PDF
ENT215_Completing-a-large-scale-migration-and-modernization-with-AWS.pdf
PPTX
O2C Customer Invoices to Receipt V15A.pptx
PPTX
observCloud-Native Containerability and monitoring.pptx
PDF
A comparative study of natural language inference in Swahili using monolingua...
PDF
How ambidextrous entrepreneurial leaders react to the artificial intelligence...
PPTX
Web Crawler for Trend Tracking Gen Z Insights.pptx
PDF
Microsoft Solutions Partner Drive Digital Transformation with D365.pdf
PDF
Taming the Chaos: How to Turn Unstructured Data into Decisions
PDF
Zenith AI: Advanced Artificial Intelligence
PDF
Developing a website for English-speaking practice to English as a foreign la...
PDF
Assigned Numbers - 2025 - Bluetooth® Document
PDF
Hybrid model detection and classification of lung cancer
PPTX
Benefits of Physical activity for teenagers.pptx
PDF
From MVP to Full-Scale Product A Startup’s Software Journey.pdf
PDF
DP Operators-handbook-extract for the Mautical Institute
PPTX
MicrosoftCybserSecurityReferenceArchitecture-April-2025.pptx
PPTX
Chapter 5: Probability Theory and Statistics
PPTX
Tartificialntelligence_presentation.pptx
PDF
DASA ADMISSION 2024_FirstRound_FirstRank_LastRank.pdf
PDF
Video forgery: An extensive analysis of inter-and intra-frame manipulation al...
ENT215_Completing-a-large-scale-migration-and-modernization-with-AWS.pdf
O2C Customer Invoices to Receipt V15A.pptx
observCloud-Native Containerability and monitoring.pptx
A comparative study of natural language inference in Swahili using monolingua...
How ambidextrous entrepreneurial leaders react to the artificial intelligence...
Web Crawler for Trend Tracking Gen Z Insights.pptx
Microsoft Solutions Partner Drive Digital Transformation with D365.pdf
Taming the Chaos: How to Turn Unstructured Data into Decisions
Zenith AI: Advanced Artificial Intelligence
Developing a website for English-speaking practice to English as a foreign la...
Assigned Numbers - 2025 - Bluetooth® Document
Hybrid model detection and classification of lung cancer
Benefits of Physical activity for teenagers.pptx
From MVP to Full-Scale Product A Startup’s Software Journey.pdf
DP Operators-handbook-extract for the Mautical Institute
MicrosoftCybserSecurityReferenceArchitecture-April-2025.pptx
Chapter 5: Probability Theory and Statistics
Tartificialntelligence_presentation.pptx
DASA ADMISSION 2024_FirstRound_FirstRank_LastRank.pdf
Video forgery: An extensive analysis of inter-and intra-frame manipulation al...

2. Pseudocode 2. Pseudocode2. Pseudocode2. Pseudocode.pptx

  • 1. Computer Programming 1 – Information Technology CMO 25 s. 2015
  • 2. Recap  A brief history of women in Software Engineering
  • 3. Pseudocode  What is pseudocode  What is algorithm  Advantages of pseudocode  How to write pseudocode  Pseudocode Flow of control
  • 4. Specific Objectives By the end of this lesson, you should 1. Write pseudo code for a given problem 2. Display teamwork in completing task 3. Cooperate in group work
  • 5. What is pseudocode? is a detailed yet readable description of what a computer program or algorithm must do, expressed in a formally-styled natural language rather than in a programming language. Pseudocode is sometimes used as a detailed step in the process of developing a program.
  • 6. Application of pseudocode Textbooks and scientific publications related to computer science and numerical computation often use pseudocode in description of algorithms, so that all programmers can understand them, even if they do not all know the same programming languages. A programmer who needs to implement a specific algorithm, especially an unfamiliar one, will often start with a pseudocode description, and then "translate" that description into the target programming language and modify it to interact correctly with the rest of the program.
  • 7. Syntax of pseudocode As the name suggests, pseudocode generally does not actually obey the syntax rules of any particular language; there is no systematic standard form, although any particular writer will generally borrow style and syntax; for example, control structures from some conventional programming language.
  • 8. What is algorithm? Algorithm: It’s an organized logical sequence of the actions or the approach towards a particular problem. A programmer implements an algorithm to solve a problem in a specific programming language. Pseudo code: It’s simply an implementation of an algorithm in the form of annotations and informative text written in plain English. It has no syntax like any of the programming language and thus can’t be compiled or interpreted by the computer.
  • 9. Advantages of pseudocode  Improves the readability of any approach. It’s one of the best approaches to start implementation of an algorithm.  Acts as a bridge between the program and the algorithm or flowchart. Also works as a rough documentation, so the program of one developer can be understood easily when a pseudo code is written out. In industries, the approach of documentation is essential. And that’s where a pseudo-code proves vital.  The main goal of a pseudo code is to explain what exactly each line of a program should do, hence making the code construction phase easier for the programmer.
  • 10. RULES FOR PSEUDOCODE 1. Write only one statement per line 2. Capitalize initial keyword 3. Indent to show hierarchy 4. End multiline structures 5. Keep statements language independent
  • 11. RULES FOR PSEUDOCODE 1. Write only one statement per line Each statement in your pseudocode should express just one action for the computer. If the task list is properly drawn, then in most cases each task will correspond to one line of pseudocode. 1 2 3 4 5
  • 12. RULES FOR PSEUDOCODE 2. Capitalize initial keyword In the example above, READ and WRITE are in caps. There are just a few keywords we will use: READ, WRITE, IF, ELSE, ENDIF, WHILE, ENDWHILE, REPEAT, UNTIL Input: READ, OBTAIN, GET Output: PRINT, DISPLAY, SHOW Compute: COMPUTE, CALCULATE, DETERMINE Initialize: SET, INIT Add one: INCREMENT, BUMP
  • 13. RULES FOR PSEUDOCODE 3. Indent to show hierarchy We will use a particular indentation pattern in each of the design structures: SEQUENCE: keep statements that are “stacked” in sequence all starting in the same column. SELECTION: indent the statements that fall inside the selection structure, but not the keywords that form the selection LOOPING: indent the statements that fall inside the loop, but not the keywords that form the loop
  • 14. RULES FOR PSEUDOCODE 4. End multiline structures See how the IF/ELSE/ENDIF is constructed above. The ENDIF (or END whatever) always is in line with the IF (or whatever starts the structure).
  • 15. RULES FOR PSEUDOCODE 5. Keep staments language independent Resist the urge to write in whatever language you are most comfortable with. In the long run, you will save time! There may be special features available in the language you plan to eventually write the program in; if you are SURE it will be written in that language, then you can use the features. If not, then avoid using the special features.
  • 16. Format ProgramName ComputerSumofTwoNumbers: BEGIN DECLARE num1, num2, sum READ num1, num2 sum is equals to num1 + num2 or sum = num1 +num2 WRITE total END
  • 17. Exercises 1. Create a pseudocode that will compute and display the area of a rectangle 2. Create a pseudocode of the activities that you do when you get up in the morning 3. Create a pseudocode on how to cook a noodles 4. Create a pseudocode on how to compute your age 5. Create a pseudocode on how to computer your grades in highschool 6. Create a pseudocode on how to withdraw money from ATM 7. Create a pseudocode that will computer the sum of 5 numbers and then display the average. 8. Write pseudocode that will compute your salary based on the basic formula (salary = (number of days work * rate per day) – deduction) 9. Write a java program that will compute the number of respondents using the sloven’s formula. To compute the number of respondents the user must enter the total population size. Sloven’s formula: n = N/(1+(Ne2)) where: n = number of respondents N = total population e = margin of error , 0.05 in this case
  • 18. Flow of Control Sequential flow Selection or Conditional flow Iterative flow
  • 20. Selection or Conditional Flow During algorithm development, we need statements which evaluate expressions and execute instructions depending on whether the expression evaluated to True or False. IF — ELSE IF — ELSE This is a conditional that is used to provide statements to be executed if a certain condition is met. This also applies to multiple conditions and different variables. Types of Selection Single Alternative (if statement) Double Alternative (if else statement) Multiple Alternative (if else if statement)
  • 24. Basic Math Symbols  When we have to make a choice between actions, we almost always base that choice on a test. The test uses phrases like “is less than” or “is equal to”. There is a universally accepted set of symbols used to represent these phrases:
  • 25. Logical Operators AND: if any of the conditions are false, the whole expression is false. IF day = “Saturday” AND weather = “sunny” WRITE “Let’s go to the beach!” ENDIF OR: if any of the conditions are true, the whole expression is true IF month = “June” OR month = “July” OR month = “August” WRITE “Yahoo! Summer vacation!” ENDIF NOT: reverses the outcome of the expression; true becomes false, false becomes true. IF day <> “Saturday” AND day <> “Sunday” WRITE “Yuk, another work day” ENDIF
  • 27. Double Alternative (if else statement)
  • 28. Multiple Alternative (if else if statement)
  • 29. Nested if statement Nested If...Then... Else statements te st for multiple conditions by placing If...Then... Else statements ins ide other If...Then. ..Else statements.
  • 32. Exercises 1. Write a pseudocode that will determine if the number is an odd or even number 2. Write a pseudocode that will print passed if the grade is above 74, failed if 74 and below 3. Write a pseudocde that will determine the highest number between two numbers. 4. Write a pseudocde that converts currency to another currency. It is a peso to dollar, dollar to peso converter program. The final result will be the converted amount of the currency. 5. Write a pseudocde that will ask the user to enter 1-10 and call that program as PrintNumberInWord which prints "ONE", "TWO",... , "NINE", "OTHER" if the int variable "number" is 1, 2,... , 9, or other, respectively. Use (a) a "if.elseif.else" statement 6. Write a java program that will ask the user to enter 2 numbers and will ask what operator to use (1 for addition, 2 for subtraction, 3 for division, and 4 for multiplication). It will also print the result. 7. ATM Machine Pseudocode. Suppose you have a balance of 5000 pesos, create a java program that will ask the user to select the transaction he/she want to access, w to withdraw (ask the user to input amount to withdraw and output the new balance), d for deposit (ask the user to input amount to deposit and output the new balance), i for inquiry (display the balance). 8. Writea a pseudocode that will ask the user to enter its grade then display the remarks. 95-100 - excellent 90-94 - very good 85-89 - good 80-84- satisfactory 76-79 - study harder 75 - passed 74 below – failed
  • 33. Iterative Flow To iterate is to repeat a set of instructions in order to generate a sequence of outcomes. We iterate so that we can achieve a certain goal. Types of Iteration for loop while loop do-while loop
  • 35. Assessment By the end of this lesson, you should 1. Write pseudo code for a given problem – Quiz and Exercises 2. Display teamwork in completing task – Project and Reporting 3. Cooperate in group work - Project and Reporting