SlideShare a Scribd company logo
1 of 4
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

What's hot

Pseudocode basics
Pseudocode basicsPseudocode basics
Pseudocode basics
kiran_kaur
 
Pseudocode flowcharts
Pseudocode flowchartsPseudocode flowcharts
Pseudocode flowcharts
nicky_walters
 
4 coding from algorithms
4 coding from algorithms4 coding from algorithms
4 coding from algorithms
hccit
 
Algorithm and pseudo codes
Algorithm and pseudo codesAlgorithm and pseudo codes
Algorithm and pseudo codes
hermiraguilar
 
Pseudocode-Flowchart
Pseudocode-FlowchartPseudocode-Flowchart
Pseudocode-Flowchart
lotlot
 

What's hot (20)

Pseudocode basics
Pseudocode basicsPseudocode basics
Pseudocode basics
 
Algorithms
AlgorithmsAlgorithms
Algorithms
 
Unit 3
Unit 3Unit 3
Unit 3
 
pseudocode and Flowchart
pseudocode and Flowchartpseudocode and Flowchart
pseudocode and Flowchart
 
COM1407: Program Control Structures – Decision Making & Branching
COM1407: Program Control Structures – Decision Making & BranchingCOM1407: Program Control Structures – Decision Making & Branching
COM1407: Program Control Structures – Decision Making & Branching
 
Pseudocode flowcharts
Pseudocode flowchartsPseudocode flowcharts
Pseudocode flowcharts
 
Pseudocode algorithim flowchart
Pseudocode algorithim flowchartPseudocode algorithim flowchart
Pseudocode algorithim flowchart
 
Basic computer-programming-2
Basic computer-programming-2Basic computer-programming-2
Basic computer-programming-2
 
Unit 3 Foc
Unit  3 FocUnit  3 Foc
Unit 3 Foc
 
CLASS VIII COMPUTERS FLOW CHART AND ALGORITHM
CLASS VIII COMPUTERS FLOW CHART AND ALGORITHMCLASS VIII COMPUTERS FLOW CHART AND ALGORITHM
CLASS VIII COMPUTERS FLOW CHART AND ALGORITHM
 
4 coding from algorithms
4 coding from algorithms4 coding from algorithms
4 coding from algorithms
 
Algorithm and pseudo codes
Algorithm and pseudo codesAlgorithm and pseudo codes
Algorithm and pseudo codes
 
FLOW OF CONTROL-INTRO PYTHON
FLOW OF CONTROL-INTRO PYTHONFLOW OF CONTROL-INTRO PYTHON
FLOW OF CONTROL-INTRO PYTHON
 
Pseudocode-Flowchart
Pseudocode-FlowchartPseudocode-Flowchart
Pseudocode-Flowchart
 
Problem solving and design
Problem solving and designProblem solving and design
Problem solving and design
 
Python - Control Structures
Python - Control StructuresPython - Control Structures
Python - Control Structures
 
Grade 10 flowcharting
Grade 10  flowchartingGrade 10  flowcharting
Grade 10 flowcharting
 
Best Techniques To Design Programs - Program Designing Techniques
Best Techniques To Design Programs - Program Designing TechniquesBest Techniques To Design Programs - Program Designing Techniques
Best Techniques To Design Programs - Program Designing Techniques
 
FLOWOFCONTROL-IF..ELSE PYTHON
FLOWOFCONTROL-IF..ELSE PYTHONFLOWOFCONTROL-IF..ELSE PYTHON
FLOWOFCONTROL-IF..ELSE PYTHON
 
Conditional statements
Conditional statementsConditional statements
Conditional statements
 

Viewers also liked

Introduction to Pseudocode
Introduction to PseudocodeIntroduction to Pseudocode
Introduction to Pseudocode
Damian T. Gordon
 
Algoritma pemrogmraman
Algoritma pemrogmramanAlgoritma pemrogmraman
Algoritma pemrogmraman
noval riansyah
 
Algoritma dan Pemrograman C++ (Pseudocode & Flowchart)
Algoritma dan Pemrograman C++ (Pseudocode & Flowchart)Algoritma dan Pemrograman C++ (Pseudocode & Flowchart)
Algoritma dan Pemrograman C++ (Pseudocode & Flowchart)
Nabil Muhammad Firdaus
 

Viewers also liked (13)

The pseudocode
The pseudocodeThe pseudocode
The pseudocode
 
Introduction to Pseudocode
Introduction to PseudocodeIntroduction to Pseudocode
Introduction to Pseudocode
 
Writing algorithms
Writing algorithmsWriting algorithms
Writing algorithms
 
Basic concepts
Basic conceptsBasic concepts
Basic concepts
 
Algoritma pemrogmraman
Algoritma pemrogmramanAlgoritma pemrogmraman
Algoritma pemrogmraman
 
Algoritma dan Struktur Data - Pseudocode
Algoritma dan Struktur Data - PseudocodeAlgoritma dan Struktur Data - Pseudocode
Algoritma dan Struktur Data - Pseudocode
 
03 pseudocode
03 pseudocode03 pseudocode
03 pseudocode
 
Tugas algoritma ( flowchart )
Tugas algoritma ( flowchart )Tugas algoritma ( flowchart )
Tugas algoritma ( flowchart )
 
Algoritma dan Pemrograman C++ (Pseudocode & Flowchart)
Algoritma dan Pemrograman C++ (Pseudocode & Flowchart)Algoritma dan Pemrograman C++ (Pseudocode & Flowchart)
Algoritma dan Pemrograman C++ (Pseudocode & Flowchart)
 
03 algoritma flowchart
03 algoritma flowchart03 algoritma flowchart
03 algoritma flowchart
 
A complete course in Program Design using Pseudocode
A complete course in Program Design using Pseudocode A complete course in Program Design using Pseudocode
A complete course in Program Design using Pseudocode
 
Software Development Techniques
Software Development TechniquesSoftware Development Techniques
Software Development Techniques
 
Flowchart pseudocode-examples
Flowchart pseudocode-examplesFlowchart pseudocode-examples
Flowchart pseudocode-examples
 

Similar to Pseudocode

CMIS 102 Hands-On Lab Week 4OverviewThis hands-on lab all.docx
CMIS 102 Hands-On Lab Week 4OverviewThis hands-on lab all.docxCMIS 102 Hands-On Lab Week 4OverviewThis hands-on lab all.docx
CMIS 102 Hands-On Lab Week 4OverviewThis hands-on lab all.docx
monicafrancis71118
 
Conditional Statements in C.pptx
Conditional Statements in C.pptxConditional Statements in C.pptx
Conditional Statements in C.pptx
DelnazBehal
 
Advanced VB: Review of the basics
Advanced VB: Review of the basicsAdvanced VB: Review of the basics
Advanced VB: Review of the basics
robertbenard
 
Advanced VB: Review of the basics
Advanced VB: Review of the basicsAdvanced VB: Review of the basics
Advanced VB: Review of the basics
robertbenard
 

Similar to Pseudocode (20)

pythonQuick.pdf
pythonQuick.pdfpythonQuick.pdf
pythonQuick.pdf
 
python notes.pdf
python notes.pdfpython notes.pdf
python notes.pdf
 
python 34💭.pdf
python 34💭.pdfpython 34💭.pdf
python 34💭.pdf
 
Python programing
Python programingPython programing
Python programing
 
CMIS 102 Hands-On Lab Week 4OverviewThis hands-on lab all.docx
CMIS 102 Hands-On Lab Week 4OverviewThis hands-on lab all.docxCMIS 102 Hands-On Lab Week 4OverviewThis hands-on lab all.docx
CMIS 102 Hands-On Lab Week 4OverviewThis hands-on lab all.docx
 
Bikalpa_Thapa_Python_Programming_(Basics).pptx
Bikalpa_Thapa_Python_Programming_(Basics).pptxBikalpa_Thapa_Python_Programming_(Basics).pptx
Bikalpa_Thapa_Python_Programming_(Basics).pptx
 
The Three Basic Selection Structures in C++ Programming Concepts
The Three Basic Selection Structures in C++ Programming ConceptsThe Three Basic Selection Structures in C++ Programming Concepts
The Three Basic Selection Structures in C++ Programming Concepts
 
UNIT 1- RELATIONAL DATABASE DESIGN USING PLSQL.pdf
UNIT 1- RELATIONAL DATABASE DESIGN USING PLSQL.pdfUNIT 1- RELATIONAL DATABASE DESIGN USING PLSQL.pdf
UNIT 1- RELATIONAL DATABASE DESIGN USING PLSQL.pdf
 
Conditional Statements in C.pptx
Conditional Statements in C.pptxConditional Statements in C.pptx
Conditional Statements in C.pptx
 
Lecture 2
Lecture 2Lecture 2
Lecture 2
 
03b loops
03b   loops03b   loops
03b loops
 
Introduction To Programming
Introduction To ProgrammingIntroduction To Programming
Introduction To Programming
 
Ecs 10 programming assignment 4 loopapalooza
Ecs 10 programming assignment 4   loopapaloozaEcs 10 programming assignment 4   loopapalooza
Ecs 10 programming assignment 4 loopapalooza
 
Design and Analysis of Algorithms.pptx
Design and Analysis of Algorithms.pptxDesign and Analysis of Algorithms.pptx
Design and Analysis of Algorithms.pptx
 
Advanced VB: Review of the basics
Advanced VB: Review of the basicsAdvanced VB: Review of the basics
Advanced VB: Review of the basics
 
Advanced VB: Review of the basics
Advanced VB: Review of the basicsAdvanced VB: Review of the basics
Advanced VB: Review of the basics
 
Switch case and looping jam
Switch case and looping jamSwitch case and looping jam
Switch case and looping jam
 
Cis160 Final Review
Cis160 Final ReviewCis160 Final Review
Cis160 Final Review
 
JAVA LOOP.pptx
JAVA LOOP.pptxJAVA LOOP.pptx
JAVA LOOP.pptx
 
Repetition Structure
Repetition StructureRepetition Structure
Repetition Structure
 

Recently uploaded

1029 - Danh muc Sach Giao Khoa 10 . pdf
1029 -  Danh muc Sach Giao Khoa 10 . pdf1029 -  Danh muc Sach Giao Khoa 10 . pdf
1029 - Danh muc Sach Giao Khoa 10 . pdf
QucHHunhnh
 
Beyond the EU: DORA and NIS 2 Directive's Global Impact
Beyond the EU: DORA and NIS 2 Directive's Global ImpactBeyond the EU: DORA and NIS 2 Directive's Global Impact
Beyond the EU: DORA and NIS 2 Directive's Global Impact
PECB
 
Russian Escort Service in Delhi 11k Hotel Foreigner Russian Call Girls in Delhi
Russian Escort Service in Delhi 11k Hotel Foreigner Russian Call Girls in DelhiRussian Escort Service in Delhi 11k Hotel Foreigner Russian Call Girls in Delhi
Russian Escort Service in Delhi 11k Hotel Foreigner Russian Call Girls in Delhi
kauryashika82
 

Recently uploaded (20)

Explore beautiful and ugly buildings. Mathematics helps us create beautiful d...
Explore beautiful and ugly buildings. Mathematics helps us create beautiful d...Explore beautiful and ugly buildings. Mathematics helps us create beautiful d...
Explore beautiful and ugly buildings. Mathematics helps us create beautiful d...
 
fourth grading exam for kindergarten in writing
fourth grading exam for kindergarten in writingfourth grading exam for kindergarten in writing
fourth grading exam for kindergarten in writing
 
Sports & Fitness Value Added Course FY..
Sports & Fitness Value Added Course FY..Sports & Fitness Value Added Course FY..
Sports & Fitness Value Added Course FY..
 
BAG TECHNIQUE Bag technique-a tool making use of public health bag through wh...
BAG TECHNIQUE Bag technique-a tool making use of public health bag through wh...BAG TECHNIQUE Bag technique-a tool making use of public health bag through wh...
BAG TECHNIQUE Bag technique-a tool making use of public health bag through wh...
 
Q4-W6-Restating Informational Text Grade 3
Q4-W6-Restating Informational Text Grade 3Q4-W6-Restating Informational Text Grade 3
Q4-W6-Restating Informational Text Grade 3
 
1029 - Danh muc Sach Giao Khoa 10 . pdf
1029 -  Danh muc Sach Giao Khoa 10 . pdf1029 -  Danh muc Sach Giao Khoa 10 . pdf
1029 - Danh muc Sach Giao Khoa 10 . pdf
 
Arihant handbook biology for class 11 .pdf
Arihant handbook biology for class 11 .pdfArihant handbook biology for class 11 .pdf
Arihant handbook biology for class 11 .pdf
 
Beyond the EU: DORA and NIS 2 Directive's Global Impact
Beyond the EU: DORA and NIS 2 Directive's Global ImpactBeyond the EU: DORA and NIS 2 Directive's Global Impact
Beyond the EU: DORA and NIS 2 Directive's Global Impact
 
Measures of Central Tendency: Mean, Median and Mode
Measures of Central Tendency: Mean, Median and ModeMeasures of Central Tendency: Mean, Median and Mode
Measures of Central Tendency: Mean, Median and Mode
 
Nutritional Needs Presentation - HLTH 104
Nutritional Needs Presentation - HLTH 104Nutritional Needs Presentation - HLTH 104
Nutritional Needs Presentation - HLTH 104
 
Key note speaker Neum_Admir Softic_ENG.pdf
Key note speaker Neum_Admir Softic_ENG.pdfKey note speaker Neum_Admir Softic_ENG.pdf
Key note speaker Neum_Admir Softic_ENG.pdf
 
Class 11th Physics NEET formula sheet pdf
Class 11th Physics NEET formula sheet pdfClass 11th Physics NEET formula sheet pdf
Class 11th Physics NEET formula sheet pdf
 
Call Girls in Dwarka Mor Delhi Contact Us 9654467111
Call Girls in Dwarka Mor Delhi Contact Us 9654467111Call Girls in Dwarka Mor Delhi Contact Us 9654467111
Call Girls in Dwarka Mor Delhi Contact Us 9654467111
 
Russian Escort Service in Delhi 11k Hotel Foreigner Russian Call Girls in Delhi
Russian Escort Service in Delhi 11k Hotel Foreigner Russian Call Girls in DelhiRussian Escort Service in Delhi 11k Hotel Foreigner Russian Call Girls in Delhi
Russian Escort Service in Delhi 11k Hotel Foreigner Russian Call Girls in Delhi
 
Código Creativo y Arte de Software | Unidad 1
Código Creativo y Arte de Software | Unidad 1Código Creativo y Arte de Software | Unidad 1
Código Creativo y Arte de Software | Unidad 1
 
Accessible design: Minimum effort, maximum impact
Accessible design: Minimum effort, maximum impactAccessible design: Minimum effort, maximum impact
Accessible design: Minimum effort, maximum impact
 
Web & Social Media Analytics Previous Year Question Paper.pdf
Web & Social Media Analytics Previous Year Question Paper.pdfWeb & Social Media Analytics Previous Year Question Paper.pdf
Web & Social Media Analytics Previous Year Question Paper.pdf
 
Interactive Powerpoint_How to Master effective communication
Interactive Powerpoint_How to Master effective communicationInteractive Powerpoint_How to Master effective communication
Interactive Powerpoint_How to Master effective communication
 
APM Welcome, APM North West Network Conference, Synergies Across Sectors
APM Welcome, APM North West Network Conference, Synergies Across SectorsAPM Welcome, APM North West Network Conference, Synergies Across Sectors
APM Welcome, APM North West Network Conference, Synergies Across Sectors
 
Holdier Curriculum Vitae (April 2024).pdf
Holdier Curriculum Vitae (April 2024).pdfHoldier Curriculum Vitae (April 2024).pdf
Holdier Curriculum Vitae (April 2024).pdf
 

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