SlideShare a Scribd company logo
How to write pseudocode
There are six basic computer operations
1. A computer can receive information
Read (information from a file)
Get (information from the keyboard)
2. A computer can put out information
Write (information to a file)
Display (information to the screen)
3. A computer can perform arithmetic
Use actual mathematical symbols or the words for the symbols
Add number to total
Total = total + number
+, -, *, /
Calculate, Compute also used
4. A computer can assign a value to a piece of data
3 cases
To give data an initial value
Initialize, Set
To assign a value as a result of some processing
‘=’
* x = 5 + y
To keep a piece of information for later use
Save, Store
5. A computer can compare two piece of information and select one of two alternative
actions
IF condition THEN
Some action
ELSE
Alternative action
ENDIF
6. A computer can repeat a group of actions
WHILE condition (is true)
Some action
ENDWHILE
FOR a number of times
Some action
ENDFOR
The Structure Theorem (and the pseudocode we use to represent the control
structures)
It is possible to write any computer program by using only three basic control structures:
sequence, selection, repetition.
Sequence
Execution of one step after another. This is represented as a sequence of
pseudocode statements:
Statement 1
Statement 2
Statement 3
Example:
Read three numbers
Add three numbers
Display total of three numbers
Selection
Presentation of a condition and the choice between two actions, the choice
depending on whether the condition
is true or false. This construct represents the decision making abilities of the computer to
compare two pieces of
Information and select one of two alternative actions. In pseudocode, selection is
represented by the keywords IF, THEN,
ELSE and ENDIF
IF condition p is true THEN
Statement in true case
ELSE
Statement in false case
ENDIF
Example:
IF student is part-time THEN
Add one to part_time_count
ELSE
Add one to full_time_count
ENDIF
A variation – We don’t need the ELSE structure – The null ELSE
IF condition p is true THEN
Statement in true case
ENDIF
Repetition
Presentation of a set of instructions to be performed repeatedly, as long as a
condition is true.
WHILE condition p is true
Statement(s) to execute
ENDWHILE
The condition is tested before any statements are executed. It is imperative that at lease
one statement within
the statement block alter the condition and eventually render it false, otherwise the logic
may result in an endless loop.
Example:
Set student total to 0
WHILE student total < 50
Read student record
Print student name and address
Add 1 to student total
ENDWHILE
Note: The variable student total is initialized before the loop condition is executed
The student total variable is incremented within the body of the loop so it will
eventually stop. These are both
Essential feature of the WHILE construct.
How to write Pseudocode?
I need to write pseudocode for a set of temperature readings in Fahrenheit, Kelvin,
Celsius and centigrade. Below is what I came up with. Is this correct?
1. Get Fahrenheit Temperature
2. Read Fahrenheit Temperature
3. While (not EOF)
a. Write c = ((F-32)/9)x5
b. Write cel = (F-30)/2
c. Write K = (F + 273)
4. Stop
• 3 months ago

More Related Content

PPTX
Pseudocode haggis
PDF
Pseudocode & flowchart examples
PPT
pseudo code basics
DOC
Program sba
PPTX
Pseudocode
PPTX
Pseudocode
PDF
Pseudocode By ZAK
PPTX
Algorithm and psuedocode
Pseudocode haggis
Pseudocode & flowchart examples
pseudo code basics
Program sba
Pseudocode
Pseudocode
Pseudocode By ZAK
Algorithm and psuedocode

What's hot (20)

PPT
Pseudocode basics
PPT
Algorithms
DOC
Unit 3
PPTX
pseudocode and Flowchart
PPTX
COM1407: Program Control Structures – Decision Making & Branching
PPTX
Pseudocode flowcharts
PPT
Pseudocode algorithim flowchart
PPTX
Basic computer-programming-2
PPT
Unit 3 Foc
DOCX
CLASS VIII COMPUTERS FLOW CHART AND ALGORITHM
PDF
4 coding from algorithms
PPTX
Algorithm and pseudo codes
PPTX
FLOW OF CONTROL-INTRO PYTHON
PPTX
Pseudocode-Flowchart
PPSX
Problem solving and design
PDF
Python - Control Structures
PPT
Grade 10 flowcharting
PPT
Best Techniques To Design Programs - Program Designing Techniques
PPTX
FLOWOFCONTROL-IF..ELSE PYTHON
PPTX
Conditional statements
Pseudocode basics
Algorithms
Unit 3
pseudocode and Flowchart
COM1407: Program Control Structures – Decision Making & Branching
Pseudocode flowcharts
Pseudocode algorithim flowchart
Basic computer-programming-2
Unit 3 Foc
CLASS VIII COMPUTERS FLOW CHART AND ALGORITHM
4 coding from algorithms
Algorithm and pseudo codes
FLOW OF CONTROL-INTRO PYTHON
Pseudocode-Flowchart
Problem solving and design
Python - Control Structures
Grade 10 flowcharting
Best Techniques To Design Programs - Program Designing Techniques
FLOWOFCONTROL-IF..ELSE PYTHON
Conditional statements
Ad

Viewers also liked (13)

PDF
The pseudocode
PPTX
Introduction to Pseudocode
PDF
Writing algorithms
PPT
Basic concepts
PPTX
Algoritma pemrogmraman
PDF
Algoritma dan Struktur Data - Pseudocode
PPSX
03 pseudocode
PDF
Tugas algoritma ( flowchart )
PDF
Algoritma dan Pemrograman C++ (Pseudocode & Flowchart)
PPT
03 algoritma flowchart
PPTX
A complete course in Program Design using Pseudocode
PDF
Flowchart pseudocode-examples
The pseudocode
Introduction to Pseudocode
Writing algorithms
Basic concepts
Algoritma pemrogmraman
Algoritma dan Struktur Data - Pseudocode
03 pseudocode
Tugas algoritma ( flowchart )
Algoritma dan Pemrograman C++ (Pseudocode & Flowchart)
03 algoritma flowchart
A complete course in Program Design using Pseudocode
Flowchart pseudocode-examples
Ad

Similar to Pseudocode (20)

PDF
pythonQuick.pdf
PDF
python notes.pdf
PDF
python 34💭.pdf
PPTX
Python programing
DOCX
CMIS 102 Hands-On Lab Week 4OverviewThis hands-on lab all.docx
PPTX
Bikalpa_Thapa_Python_Programming_(Basics).pptx
PPTX
made it easy: python quick reference for beginners
PPT
The Three Basic Selection Structures in C++ Programming Concepts
PDF
UNIT 1- RELATIONAL DATABASE DESIGN USING PLSQL.pdf
PPTX
Conditional Statements in C.pptx
PPT
Lecture 2
PPT
03b loops
PPT
Introduction To Programming
DOCX
Ecs 10 programming assignment 4 loopapalooza
PPTX
Design and Analysis of Algorithms.pptx
PPTX
Advanced VB: Review of the basics
PPTX
Advanced VB: Review of the basics
PPTX
Switch case and looping jam
PPTX
JAVA LOOP.pptx
pythonQuick.pdf
python notes.pdf
python 34💭.pdf
Python programing
CMIS 102 Hands-On Lab Week 4OverviewThis hands-on lab all.docx
Bikalpa_Thapa_Python_Programming_(Basics).pptx
made it easy: python quick reference for beginners
The Three Basic Selection Structures in C++ Programming Concepts
UNIT 1- RELATIONAL DATABASE DESIGN USING PLSQL.pdf
Conditional Statements in C.pptx
Lecture 2
03b loops
Introduction To Programming
Ecs 10 programming assignment 4 loopapalooza
Design and Analysis of Algorithms.pptx
Advanced VB: Review of the basics
Advanced VB: Review of the basics
Switch case and looping jam
JAVA LOOP.pptx

Recently uploaded (20)

PDF
Abdominal Access Techniques with Prof. Dr. R K Mishra
PPTX
Institutional Correction lecture only . . .
PDF
Insiders guide to clinical Medicine.pdf
PDF
Saundersa Comprehensive Review for the NCLEX-RN Examination.pdf
PPTX
PPH.pptx obstetrics and gynecology in nursing
PDF
Classroom Observation Tools for Teachers
PPTX
IMMUNITY IMMUNITY refers to protection against infection, and the immune syst...
PPTX
Renaissance Architecture: A Journey from Faith to Humanism
PDF
grade 11-chemistry_fetena_net_5883.pdf teacher guide for all student
PDF
TR - Agricultural Crops Production NC III.pdf
PPTX
school management -TNTEU- B.Ed., Semester II Unit 1.pptx
PDF
Anesthesia in Laparoscopic Surgery in India
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 Đ...
PPTX
Microbial diseases, their pathogenesis and prophylaxis
PDF
Chapter 2 Heredity, Prenatal Development, and Birth.pdf
PPTX
Lesson notes of climatology university.
PDF
01-Introduction-to-Information-Management.pdf
PPTX
GDM (1) (1).pptx small presentation for students
PDF
2.FourierTransform-ShortQuestionswithAnswers.pdf
PDF
Sports Quiz easy sports quiz sports quiz
Abdominal Access Techniques with Prof. Dr. R K Mishra
Institutional Correction lecture only . . .
Insiders guide to clinical Medicine.pdf
Saundersa Comprehensive Review for the NCLEX-RN Examination.pdf
PPH.pptx obstetrics and gynecology in nursing
Classroom Observation Tools for Teachers
IMMUNITY IMMUNITY refers to protection against infection, and the immune syst...
Renaissance Architecture: A Journey from Faith to Humanism
grade 11-chemistry_fetena_net_5883.pdf teacher guide for all student
TR - Agricultural Crops Production NC III.pdf
school management -TNTEU- B.Ed., Semester II Unit 1.pptx
Anesthesia in Laparoscopic Surgery in India
BÀI TẬP BỔ TRỢ 4 KỸ NĂNG TIẾNG ANH 9 GLOBAL SUCCESS - CẢ NĂM - BÁM SÁT FORM Đ...
Microbial diseases, their pathogenesis and prophylaxis
Chapter 2 Heredity, Prenatal Development, and Birth.pdf
Lesson notes of climatology university.
01-Introduction-to-Information-Management.pdf
GDM (1) (1).pptx small presentation for students
2.FourierTransform-ShortQuestionswithAnswers.pdf
Sports Quiz easy sports quiz sports quiz

Pseudocode

  • 1. How to write pseudocode There are six basic computer operations 1. A computer can receive information Read (information from a file) Get (information from the keyboard) 2. A computer can put out information Write (information to a file) Display (information to the screen) 3. A computer can perform arithmetic Use actual mathematical symbols or the words for the symbols Add number to total Total = total + number +, -, *, / Calculate, Compute also used 4. A computer can assign a value to a piece of data 3 cases To give data an initial value Initialize, Set To assign a value as a result of some processing ‘=’ * x = 5 + y To keep a piece of information for later use Save, Store 5. A computer can compare two piece of information and select one of two alternative actions IF condition THEN Some action ELSE Alternative action ENDIF 6. A computer can repeat a group of actions WHILE condition (is true) Some action ENDWHILE FOR a number of times Some action ENDFOR
  • 2. The Structure Theorem (and the pseudocode we use to represent the control structures) It is possible to write any computer program by using only three basic control structures: sequence, selection, repetition. Sequence Execution of one step after another. This is represented as a sequence of pseudocode statements: Statement 1 Statement 2 Statement 3 Example: Read three numbers Add three numbers Display total of three numbers Selection Presentation of a condition and the choice between two actions, the choice depending on whether the condition is true or false. This construct represents the decision making abilities of the computer to compare two pieces of Information and select one of two alternative actions. In pseudocode, selection is represented by the keywords IF, THEN, ELSE and ENDIF IF condition p is true THEN Statement in true case ELSE Statement in false case ENDIF Example: IF student is part-time THEN Add one to part_time_count ELSE Add one to full_time_count ENDIF
  • 3. A variation – We don’t need the ELSE structure – The null ELSE IF condition p is true THEN Statement in true case ENDIF Repetition Presentation of a set of instructions to be performed repeatedly, as long as a condition is true. WHILE condition p is true Statement(s) to execute ENDWHILE The condition is tested before any statements are executed. It is imperative that at lease one statement within the statement block alter the condition and eventually render it false, otherwise the logic may result in an endless loop. Example: Set student total to 0 WHILE student total < 50 Read student record Print student name and address Add 1 to student total ENDWHILE Note: The variable student total is initialized before the loop condition is executed The student total variable is incremented within the body of the loop so it will eventually stop. These are both Essential feature of the WHILE construct. How to write Pseudocode? I need to write pseudocode for a set of temperature readings in Fahrenheit, Kelvin, Celsius and centigrade. Below is what I came up with. Is this correct? 1. Get Fahrenheit Temperature 2. Read Fahrenheit Temperature 3. While (not EOF) a. Write c = ((F-32)/9)x5
  • 4. b. Write cel = (F-30)/2 c. Write K = (F + 273) 4. Stop • 3 months ago