尊敬的 微信汇率:1円 ≈ 0.046166 元 支付宝汇率:1円 ≈ 0.046257元 [退出登录]
SlideShare a Scribd company logo
Introductory Examples of Flowcharts and Pseudocode 
1 
Chapter 3 
Calculate Pay - sequence 
Start 
input hours 
input rate 
pay = hours * rate 
print pay 
End 
Begin 
input hours 
input rate 
pay = hours * rate 
print pay 
End 
2 
Sum of 2 Numbers - sequence 
Start 
input x 
input y 
sum = x + y 
output sum 
End 
Begin 
input x, y 
sum = x + y 
print sum 
End
3 
Average of 3 Numbers - sequence 
Start 
input x 
input y 
input z 
sum = x + y + z 
avg = sum / 3.0 
print avg 
End 
Begin 
input x 
input y 
input z 
sum = x + y + z 
avg = sum / 3.0 
print avg 
End 
4 
Calculate Pay with Overtime - selection 
input hours, rate 
hours ≤ 40 
pay = hours * rate 
print pay 
pay = 40 * rate + 
(hours - 40) * 1.5 * rate 
F 
T 
Begin 
input hours, rate 
if hours ≤ 40 then 
pay = hours * rate 
else 
pay = 40 * rate + (hours – 40) * rate * 1.5 
print pay 
End
5 
Average of 10 Numbers – iteration with a while loop 
i = 0 
sum = 0 
while i < 10 
input x 
avg = sum / 10.0 
sum = x + sum print avg 
increment i 
Begin 
i = 0 
sum = 0 
while i < 10 
input x 
sum = sum + x 
++i 
avg = sum / 10.0 
print avg 
End 
F 
T 
Begin 
i = 0 
sum = 0 
a: if i ≥ 10 goto b 
input x 
sum = sum + x 
++i 
goto a 
b: avg = sum / 10.0 
print avg 
End 
Comment Strictly speaking, the above flowchart corresponds more to the 
pseudocode on the right hand side. However, as you can see, ‘gotos’ make 
code less modular and more unreadable. 
6 
Average of 10 Numbers – iteration with a for loop 
sum = 0 
i 
1 
1 10 
1 
input x 
sum = x + sum 
i 
avg = sum / 10.0 
print avg 
Begin 
sum = 0 
for i = 1 to 10 
input x 
sum = sum + x 
avg = sum / 10.0 
print avg 
End
7 
Flowchart for Function or Subroutine Module 
Average 
print “average is”, avg 
input a, b, c 
Average 
sum = a + b + c 
avg = sum / 3 
Exit 
Begin 
print “input 3 numbers” 
input a, b, c 
End 
Begin 
print “Input 3 numbers: ” 
input a, b, c 
avg = average(a, b, c) 
print “Average is ”, avg 
End 
Begin Average(a, b, c) 
sum = a + b + c 
avg = sum / 3.0 
return avg 
End

More Related Content

What's hot

pseudo code basics
pseudo code basicspseudo code basics
pseudo code basics
Sabik T S
 
Looping Statement And Flow Chart
 Looping Statement And Flow Chart Looping Statement And Flow Chart
Looping Statement And Flow Chart
Rahul Sahu
 
Types of loops in c language
Types of loops in c languageTypes of loops in c language
Types of loops in c language
sneha2494
 
Loops c++
Loops c++Loops c++
Loops c++
Shivani Singh
 
Break and continue
Break and continueBreak and continue
Break and continue
Frijo Francis
 
Pseudocode flowcharts
Pseudocode flowchartsPseudocode flowcharts
Pseudocode flowcharts
nicky_walters
 
COM1407: Input/ Output Functions
COM1407: Input/ Output FunctionsCOM1407: Input/ Output Functions
COM1407: Input/ Output Functions
Hemantha Kulathilake
 
Flowchart and algorithm
Flowchart and algorithmFlowchart and algorithm
Flowchart and algorithm
DHANIK VIKRANT
 
Decision Making and Looping
Decision Making and LoopingDecision Making and Looping
Decision Making and Looping
Munazza-Mah-Jabeen
 
algo
algoalgo
algo
Rao Khan
 
Problem Solving Techniques and Introduction to C
Problem Solving Techniques and Introduction to CProblem Solving Techniques and Introduction to C
Problem Solving Techniques and Introduction to C
Prabu U
 
C++ IF STATMENT AND ITS TYPE
C++ IF STATMENT AND ITS TYPEC++ IF STATMENT AND ITS TYPE
Operating Systems: Process Scheduling
Operating Systems: Process SchedulingOperating Systems: Process Scheduling
Operating Systems: Process Scheduling
Damian T. Gordon
 
CONDITIONAL STATEMENT IN C LANGUAGE
CONDITIONAL STATEMENT IN C LANGUAGECONDITIONAL STATEMENT IN C LANGUAGE
CONDITIONAL STATEMENT IN C LANGUAGE
Ideal Eyes Business College
 
Simple Calculator Flowchart
Simple Calculator FlowchartSimple Calculator Flowchart
Simple Calculator Flowchart
Omprakash Chauhan
 
Stacks in c++
Stacks in c++Stacks in c++
Stacks in c++
Vineeta Garg
 
Input Output Management In C Programming
Input Output Management In C ProgrammingInput Output Management In C Programming
Input Output Management In C Programming
Kamal Acharya
 
Control structures in c++
Control structures in c++Control structures in c++
Control structures in c++
Nitin Jawla
 
C program
C programC program
C program
AJAL A J
 
Types of Statements in Python Programming Language
Types of Statements in Python Programming LanguageTypes of Statements in Python Programming Language
Types of Statements in Python Programming Language
Explore Skilled
 

What's hot (20)

pseudo code basics
pseudo code basicspseudo code basics
pseudo code basics
 
Looping Statement And Flow Chart
 Looping Statement And Flow Chart Looping Statement And Flow Chart
Looping Statement And Flow Chart
 
Types of loops in c language
Types of loops in c languageTypes of loops in c language
Types of loops in c language
 
Loops c++
Loops c++Loops c++
Loops c++
 
Break and continue
Break and continueBreak and continue
Break and continue
 
Pseudocode flowcharts
Pseudocode flowchartsPseudocode flowcharts
Pseudocode flowcharts
 
COM1407: Input/ Output Functions
COM1407: Input/ Output FunctionsCOM1407: Input/ Output Functions
COM1407: Input/ Output Functions
 
Flowchart and algorithm
Flowchart and algorithmFlowchart and algorithm
Flowchart and algorithm
 
Decision Making and Looping
Decision Making and LoopingDecision Making and Looping
Decision Making and Looping
 
algo
algoalgo
algo
 
Problem Solving Techniques and Introduction to C
Problem Solving Techniques and Introduction to CProblem Solving Techniques and Introduction to C
Problem Solving Techniques and Introduction to C
 
C++ IF STATMENT AND ITS TYPE
C++ IF STATMENT AND ITS TYPEC++ IF STATMENT AND ITS TYPE
C++ IF STATMENT AND ITS TYPE
 
Operating Systems: Process Scheduling
Operating Systems: Process SchedulingOperating Systems: Process Scheduling
Operating Systems: Process Scheduling
 
CONDITIONAL STATEMENT IN C LANGUAGE
CONDITIONAL STATEMENT IN C LANGUAGECONDITIONAL STATEMENT IN C LANGUAGE
CONDITIONAL STATEMENT IN C LANGUAGE
 
Simple Calculator Flowchart
Simple Calculator FlowchartSimple Calculator Flowchart
Simple Calculator Flowchart
 
Stacks in c++
Stacks in c++Stacks in c++
Stacks in c++
 
Input Output Management In C Programming
Input Output Management In C ProgrammingInput Output Management In C Programming
Input Output Management In C Programming
 
Control structures in c++
Control structures in c++Control structures in c++
Control structures in c++
 
C program
C programC program
C program
 
Types of Statements in Python Programming Language
Types of Statements in Python Programming LanguageTypes of Statements in Python Programming Language
Types of Statements in Python Programming Language
 

Similar to Flowchart pseudocode-examples

C code This program will calculate the sum of 10 positive .docx
 C code This program will calculate the sum of 10 positive .docx C code This program will calculate the sum of 10 positive .docx
C code This program will calculate the sum of 10 positive .docx
aryan532920
 
ICP - Lecture 9
ICP - Lecture 9ICP - Lecture 9
ICP - Lecture 9
hassaanciit
 
Flowchart and algorithm
Flowchart and algorithmFlowchart and algorithm
Flowchart and algorithm
Sayali Shivarkar
 
Introduction to python programming
Introduction to python programmingIntroduction to python programming
Introduction to python programming
Rakotoarison Louis Frederick
 
1. control structures in the python.pptx
1. control structures in the python.pptx1. control structures in the python.pptx
1. control structures in the python.pptx
DURAIMURUGANM2
 
Python Programming Introduction - Loops & Boolean
Python Programming Introduction  - Loops & BooleanPython Programming Introduction  - Loops & Boolean
Python Programming Introduction - Loops & Boolean
Ruchika Sinha
 
ICT_Seminar_flow_charts_for_2013_Nov.pptx
ICT_Seminar_flow_charts_for_2013_Nov.pptxICT_Seminar_flow_charts_for_2013_Nov.pptx
ICT_Seminar_flow_charts_for_2013_Nov.pptx
ssuser2f67c91
 
03 control
03 control03 control
03 control
Massoud Hamad
 
Python Math Concepts Book
Python Math Concepts BookPython Math Concepts Book
Python Math Concepts Book
Rohan Karunaratne
 
Psuedocode1, algorithm1, Flowchart1.pptx
Psuedocode1, algorithm1, Flowchart1.pptxPsuedocode1, algorithm1, Flowchart1.pptx
Psuedocode1, algorithm1, Flowchart1.pptx
MattFlordeliza1
 
lecture 2.pptx
lecture 2.pptxlecture 2.pptx
lecture 2.pptx
Anonymous9etQKwW
 
error 2.pdf101316, 6(46 PM01_errorPage 1 of 5http.docx
error 2.pdf101316, 6(46 PM01_errorPage 1 of 5http.docxerror 2.pdf101316, 6(46 PM01_errorPage 1 of 5http.docx
error 2.pdf101316, 6(46 PM01_errorPage 1 of 5http.docx
SALU18
 
Python Training in Chandigarh(Mohali)
Python Training in Chandigarh(Mohali)Python Training in Chandigarh(Mohali)
Python Training in Chandigarh(Mohali)
ExcellenceAcadmy
 
Python Training Course in Chandigarh(Mohali)
Python Training Course in Chandigarh(Mohali)Python Training Course in Chandigarh(Mohali)
Python Training Course in Chandigarh(Mohali)
ExcellenceAcadmy
 
Pengenalan kepada pengaturcaraan berstruktur
Pengenalan kepada pengaturcaraan berstrukturPengenalan kepada pengaturcaraan berstruktur
Pengenalan kepada pengaturcaraan berstruktur
Unit Kediaman Luar Kampus
 
ch05-program-logic-indefinite-loops.ppt
ch05-program-logic-indefinite-loops.pptch05-program-logic-indefinite-loops.ppt
ch05-program-logic-indefinite-loops.ppt
Mahyuddin8
 
C-LOOP-Session-2.pptx
C-LOOP-Session-2.pptxC-LOOP-Session-2.pptx
C-LOOP-Session-2.pptx
Sarkunavathi Aribal
 
Pa1 flow chart
Pa1 flow chartPa1 flow chart
Pa1 flow chart
aiclub_slides
 
C++ in 10 Hours.pdf.pdf
C++ in 10 Hours.pdf.pdfC++ in 10 Hours.pdf.pdf
C++ in 10 Hours.pdf.pdf
SumitSingh813090
 
3.2 looping statement
3.2 looping statement3.2 looping statement
3.2 looping statement
PhD Research Scholar
 

Similar to Flowchart pseudocode-examples (20)

C code This program will calculate the sum of 10 positive .docx
 C code This program will calculate the sum of 10 positive .docx C code This program will calculate the sum of 10 positive .docx
C code This program will calculate the sum of 10 positive .docx
 
ICP - Lecture 9
ICP - Lecture 9ICP - Lecture 9
ICP - Lecture 9
 
Flowchart and algorithm
Flowchart and algorithmFlowchart and algorithm
Flowchart and algorithm
 
Introduction to python programming
Introduction to python programmingIntroduction to python programming
Introduction to python programming
 
1. control structures in the python.pptx
1. control structures in the python.pptx1. control structures in the python.pptx
1. control structures in the python.pptx
 
Python Programming Introduction - Loops & Boolean
Python Programming Introduction  - Loops & BooleanPython Programming Introduction  - Loops & Boolean
Python Programming Introduction - Loops & Boolean
 
ICT_Seminar_flow_charts_for_2013_Nov.pptx
ICT_Seminar_flow_charts_for_2013_Nov.pptxICT_Seminar_flow_charts_for_2013_Nov.pptx
ICT_Seminar_flow_charts_for_2013_Nov.pptx
 
03 control
03 control03 control
03 control
 
Python Math Concepts Book
Python Math Concepts BookPython Math Concepts Book
Python Math Concepts Book
 
Psuedocode1, algorithm1, Flowchart1.pptx
Psuedocode1, algorithm1, Flowchart1.pptxPsuedocode1, algorithm1, Flowchart1.pptx
Psuedocode1, algorithm1, Flowchart1.pptx
 
lecture 2.pptx
lecture 2.pptxlecture 2.pptx
lecture 2.pptx
 
error 2.pdf101316, 6(46 PM01_errorPage 1 of 5http.docx
error 2.pdf101316, 6(46 PM01_errorPage 1 of 5http.docxerror 2.pdf101316, 6(46 PM01_errorPage 1 of 5http.docx
error 2.pdf101316, 6(46 PM01_errorPage 1 of 5http.docx
 
Python Training in Chandigarh(Mohali)
Python Training in Chandigarh(Mohali)Python Training in Chandigarh(Mohali)
Python Training in Chandigarh(Mohali)
 
Python Training Course in Chandigarh(Mohali)
Python Training Course in Chandigarh(Mohali)Python Training Course in Chandigarh(Mohali)
Python Training Course in Chandigarh(Mohali)
 
Pengenalan kepada pengaturcaraan berstruktur
Pengenalan kepada pengaturcaraan berstrukturPengenalan kepada pengaturcaraan berstruktur
Pengenalan kepada pengaturcaraan berstruktur
 
ch05-program-logic-indefinite-loops.ppt
ch05-program-logic-indefinite-loops.pptch05-program-logic-indefinite-loops.ppt
ch05-program-logic-indefinite-loops.ppt
 
C-LOOP-Session-2.pptx
C-LOOP-Session-2.pptxC-LOOP-Session-2.pptx
C-LOOP-Session-2.pptx
 
Pa1 flow chart
Pa1 flow chartPa1 flow chart
Pa1 flow chart
 
C++ in 10 Hours.pdf.pdf
C++ in 10 Hours.pdf.pdfC++ in 10 Hours.pdf.pdf
C++ in 10 Hours.pdf.pdf
 
3.2 looping statement
3.2 looping statement3.2 looping statement
3.2 looping statement
 

Recently uploaded

Northern Engraving | Modern Metal Trim, Nameplates and Appliance Panels
Northern Engraving | Modern Metal Trim, Nameplates and Appliance PanelsNorthern Engraving | Modern Metal Trim, Nameplates and Appliance Panels
Northern Engraving | Modern Metal Trim, Nameplates and Appliance Panels
Northern Engraving
 
Mutation Testing for Task-Oriented Chatbots
Mutation Testing for Task-Oriented ChatbotsMutation Testing for Task-Oriented Chatbots
Mutation Testing for Task-Oriented Chatbots
Pablo Gómez Abajo
 
ScyllaDB Tablets: Rethinking Replication
ScyllaDB Tablets: Rethinking ReplicationScyllaDB Tablets: Rethinking Replication
ScyllaDB Tablets: Rethinking Replication
ScyllaDB
 
Poznań ACE event - 19.06.2024 Team 24 Wrapup slidedeck
Poznań ACE event - 19.06.2024 Team 24 Wrapup slidedeckPoznań ACE event - 19.06.2024 Team 24 Wrapup slidedeck
Poznań ACE event - 19.06.2024 Team 24 Wrapup slidedeck
FilipTomaszewski5
 
Radically Outperforming DynamoDB @ Digital Turbine with SADA and Google Cloud
Radically Outperforming DynamoDB @ Digital Turbine with SADA and Google CloudRadically Outperforming DynamoDB @ Digital Turbine with SADA and Google Cloud
Radically Outperforming DynamoDB @ Digital Turbine with SADA and Google Cloud
ScyllaDB
 
APJC Introduction to ThousandEyes Webinar
APJC Introduction to ThousandEyes WebinarAPJC Introduction to ThousandEyes Webinar
APJC Introduction to ThousandEyes Webinar
ThousandEyes
 
CNSCon 2024 Lightning Talk: Don’t Make Me Impersonate My Identity
CNSCon 2024 Lightning Talk: Don’t Make Me Impersonate My IdentityCNSCon 2024 Lightning Talk: Don’t Make Me Impersonate My Identity
CNSCon 2024 Lightning Talk: Don’t Make Me Impersonate My Identity
Cynthia Thomas
 
Session 1 - Intro to Robotic Process Automation.pdf
Session 1 - Intro to Robotic Process Automation.pdfSession 1 - Intro to Robotic Process Automation.pdf
Session 1 - Intro to Robotic Process Automation.pdf
UiPathCommunity
 
LF Energy Webinar: Carbon Data Specifications: Mechanisms to Improve Data Acc...
LF Energy Webinar: Carbon Data Specifications: Mechanisms to Improve Data Acc...LF Energy Webinar: Carbon Data Specifications: Mechanisms to Improve Data Acc...
LF Energy Webinar: Carbon Data Specifications: Mechanisms to Improve Data Acc...
DanBrown980551
 
Lee Barnes - Path to Becoming an Effective Test Automation Engineer.pdf
Lee Barnes - Path to Becoming an Effective Test Automation Engineer.pdfLee Barnes - Path to Becoming an Effective Test Automation Engineer.pdf
Lee Barnes - Path to Becoming an Effective Test Automation Engineer.pdf
leebarnesutopia
 
CTO Insights: Steering a High-Stakes Database Migration
CTO Insights: Steering a High-Stakes Database MigrationCTO Insights: Steering a High-Stakes Database Migration
CTO Insights: Steering a High-Stakes Database Migration
ScyllaDB
 
Containers & AI - Beauty and the Beast!?!
Containers & AI - Beauty and the Beast!?!Containers & AI - Beauty and the Beast!?!
Containers & AI - Beauty and the Beast!?!
Tobias Schneck
 
An Introduction to All Data Enterprise Integration
An Introduction to All Data Enterprise IntegrationAn Introduction to All Data Enterprise Integration
An Introduction to All Data Enterprise Integration
Safe Software
 
An All-Around Benchmark of the DBaaS Market
An All-Around Benchmark of the DBaaS MarketAn All-Around Benchmark of the DBaaS Market
An All-Around Benchmark of the DBaaS Market
ScyllaDB
 
Fuxnet [EN] .pdf
Fuxnet [EN]                                   .pdfFuxnet [EN]                                   .pdf
Fuxnet [EN] .pdf
Overkill Security
 
Chapter 5 - Managing Test Activities V4.0
Chapter 5 - Managing Test Activities V4.0Chapter 5 - Managing Test Activities V4.0
Chapter 5 - Managing Test Activities V4.0
Neeraj Kumar Singh
 
MongoDB to ScyllaDB: Technical Comparison and the Path to Success
MongoDB to ScyllaDB: Technical Comparison and the Path to SuccessMongoDB to ScyllaDB: Technical Comparison and the Path to Success
MongoDB to ScyllaDB: Technical Comparison and the Path to Success
ScyllaDB
 
QR Secure: A Hybrid Approach Using Machine Learning and Security Validation F...
QR Secure: A Hybrid Approach Using Machine Learning and Security Validation F...QR Secure: A Hybrid Approach Using Machine Learning and Security Validation F...
QR Secure: A Hybrid Approach Using Machine Learning and Security Validation F...
AlexanderRichford
 
MySQL InnoDB Storage Engine: Deep Dive - Mydbops
MySQL InnoDB Storage Engine: Deep Dive - MydbopsMySQL InnoDB Storage Engine: Deep Dive - Mydbops
MySQL InnoDB Storage Engine: Deep Dive - Mydbops
Mydbops
 
Communications Mining Series - Zero to Hero - Session 2
Communications Mining Series - Zero to Hero - Session 2Communications Mining Series - Zero to Hero - Session 2
Communications Mining Series - Zero to Hero - Session 2
DianaGray10
 

Recently uploaded (20)

Northern Engraving | Modern Metal Trim, Nameplates and Appliance Panels
Northern Engraving | Modern Metal Trim, Nameplates and Appliance PanelsNorthern Engraving | Modern Metal Trim, Nameplates and Appliance Panels
Northern Engraving | Modern Metal Trim, Nameplates and Appliance Panels
 
Mutation Testing for Task-Oriented Chatbots
Mutation Testing for Task-Oriented ChatbotsMutation Testing for Task-Oriented Chatbots
Mutation Testing for Task-Oriented Chatbots
 
ScyllaDB Tablets: Rethinking Replication
ScyllaDB Tablets: Rethinking ReplicationScyllaDB Tablets: Rethinking Replication
ScyllaDB Tablets: Rethinking Replication
 
Poznań ACE event - 19.06.2024 Team 24 Wrapup slidedeck
Poznań ACE event - 19.06.2024 Team 24 Wrapup slidedeckPoznań ACE event - 19.06.2024 Team 24 Wrapup slidedeck
Poznań ACE event - 19.06.2024 Team 24 Wrapup slidedeck
 
Radically Outperforming DynamoDB @ Digital Turbine with SADA and Google Cloud
Radically Outperforming DynamoDB @ Digital Turbine with SADA and Google CloudRadically Outperforming DynamoDB @ Digital Turbine with SADA and Google Cloud
Radically Outperforming DynamoDB @ Digital Turbine with SADA and Google Cloud
 
APJC Introduction to ThousandEyes Webinar
APJC Introduction to ThousandEyes WebinarAPJC Introduction to ThousandEyes Webinar
APJC Introduction to ThousandEyes Webinar
 
CNSCon 2024 Lightning Talk: Don’t Make Me Impersonate My Identity
CNSCon 2024 Lightning Talk: Don’t Make Me Impersonate My IdentityCNSCon 2024 Lightning Talk: Don’t Make Me Impersonate My Identity
CNSCon 2024 Lightning Talk: Don’t Make Me Impersonate My Identity
 
Session 1 - Intro to Robotic Process Automation.pdf
Session 1 - Intro to Robotic Process Automation.pdfSession 1 - Intro to Robotic Process Automation.pdf
Session 1 - Intro to Robotic Process Automation.pdf
 
LF Energy Webinar: Carbon Data Specifications: Mechanisms to Improve Data Acc...
LF Energy Webinar: Carbon Data Specifications: Mechanisms to Improve Data Acc...LF Energy Webinar: Carbon Data Specifications: Mechanisms to Improve Data Acc...
LF Energy Webinar: Carbon Data Specifications: Mechanisms to Improve Data Acc...
 
Lee Barnes - Path to Becoming an Effective Test Automation Engineer.pdf
Lee Barnes - Path to Becoming an Effective Test Automation Engineer.pdfLee Barnes - Path to Becoming an Effective Test Automation Engineer.pdf
Lee Barnes - Path to Becoming an Effective Test Automation Engineer.pdf
 
CTO Insights: Steering a High-Stakes Database Migration
CTO Insights: Steering a High-Stakes Database MigrationCTO Insights: Steering a High-Stakes Database Migration
CTO Insights: Steering a High-Stakes Database Migration
 
Containers & AI - Beauty and the Beast!?!
Containers & AI - Beauty and the Beast!?!Containers & AI - Beauty and the Beast!?!
Containers & AI - Beauty and the Beast!?!
 
An Introduction to All Data Enterprise Integration
An Introduction to All Data Enterprise IntegrationAn Introduction to All Data Enterprise Integration
An Introduction to All Data Enterprise Integration
 
An All-Around Benchmark of the DBaaS Market
An All-Around Benchmark of the DBaaS MarketAn All-Around Benchmark of the DBaaS Market
An All-Around Benchmark of the DBaaS Market
 
Fuxnet [EN] .pdf
Fuxnet [EN]                                   .pdfFuxnet [EN]                                   .pdf
Fuxnet [EN] .pdf
 
Chapter 5 - Managing Test Activities V4.0
Chapter 5 - Managing Test Activities V4.0Chapter 5 - Managing Test Activities V4.0
Chapter 5 - Managing Test Activities V4.0
 
MongoDB to ScyllaDB: Technical Comparison and the Path to Success
MongoDB to ScyllaDB: Technical Comparison and the Path to SuccessMongoDB to ScyllaDB: Technical Comparison and the Path to Success
MongoDB to ScyllaDB: Technical Comparison and the Path to Success
 
QR Secure: A Hybrid Approach Using Machine Learning and Security Validation F...
QR Secure: A Hybrid Approach Using Machine Learning and Security Validation F...QR Secure: A Hybrid Approach Using Machine Learning and Security Validation F...
QR Secure: A Hybrid Approach Using Machine Learning and Security Validation F...
 
MySQL InnoDB Storage Engine: Deep Dive - Mydbops
MySQL InnoDB Storage Engine: Deep Dive - MydbopsMySQL InnoDB Storage Engine: Deep Dive - Mydbops
MySQL InnoDB Storage Engine: Deep Dive - Mydbops
 
Communications Mining Series - Zero to Hero - Session 2
Communications Mining Series - Zero to Hero - Session 2Communications Mining Series - Zero to Hero - Session 2
Communications Mining Series - Zero to Hero - Session 2
 

Flowchart pseudocode-examples

  • 1. Introductory Examples of Flowcharts and Pseudocode 1 Chapter 3 Calculate Pay - sequence Start input hours input rate pay = hours * rate print pay End Begin input hours input rate pay = hours * rate print pay End 2 Sum of 2 Numbers - sequence Start input x input y sum = x + y output sum End Begin input x, y sum = x + y print sum End
  • 2. 3 Average of 3 Numbers - sequence Start input x input y input z sum = x + y + z avg = sum / 3.0 print avg End Begin input x input y input z sum = x + y + z avg = sum / 3.0 print avg End 4 Calculate Pay with Overtime - selection input hours, rate hours ≤ 40 pay = hours * rate print pay pay = 40 * rate + (hours - 40) * 1.5 * rate F T Begin input hours, rate if hours ≤ 40 then pay = hours * rate else pay = 40 * rate + (hours – 40) * rate * 1.5 print pay End
  • 3. 5 Average of 10 Numbers – iteration with a while loop i = 0 sum = 0 while i < 10 input x avg = sum / 10.0 sum = x + sum print avg increment i Begin i = 0 sum = 0 while i < 10 input x sum = sum + x ++i avg = sum / 10.0 print avg End F T Begin i = 0 sum = 0 a: if i ≥ 10 goto b input x sum = sum + x ++i goto a b: avg = sum / 10.0 print avg End Comment Strictly speaking, the above flowchart corresponds more to the pseudocode on the right hand side. However, as you can see, ‘gotos’ make code less modular and more unreadable. 6 Average of 10 Numbers – iteration with a for loop sum = 0 i 1 1 10 1 input x sum = x + sum i avg = sum / 10.0 print avg Begin sum = 0 for i = 1 to 10 input x sum = sum + x avg = sum / 10.0 print avg End
  • 4. 7 Flowchart for Function or Subroutine Module Average print “average is”, avg input a, b, c Average sum = a + b + c avg = sum / 3 Exit Begin print “input 3 numbers” input a, b, c End Begin print “Input 3 numbers: ” input a, b, c avg = average(a, b, c) print “Average is ”, avg End Begin Average(a, b, c) sum = a + b + c avg = sum / 3.0 return avg End
  翻译: