The document discusses algorithms and flowcharts, explaining that an algorithm is a sequence of steps to solve a problem and a flowchart uses symbols to represent the logic and flow of an algorithm. It provides examples of writing pseudocode algorithms for different problems and drawing corresponding flowcharts, including using decision structures like if-then-else and handling multiple conditions with nested if statements.
The document discusses algorithms and flowcharts, explaining that an algorithm is a sequence of steps to solve a problem and a flowchart uses graphical representations to show the logic and sequence of operations in an algorithm. It provides examples of writing pseudocode algorithms for different problems and drawing corresponding flowcharts to visually depict the logic and flow of the algorithms.
Basic Slides on Algorithms and Flowchartsmoazwinner
This document discusses algorithms, flowcharts, and problem solving. It provides examples of writing pseudocode algorithms and creating corresponding flowcharts. Key points:
- Algorithms are step-by-step solutions to problems, while flowcharts use symbols to visually represent algorithm logic and flow.
- Pseudocode uses everyday language to describe algorithms before implementation.
- Common flowchart symbols include shapes for start/end, input/output, decisions, and processes connected by arrows showing flow.
- Examples show algorithms and flowcharts for calculating grades, converting units, finding a rectangle area, and other problems.
The document discusses algorithms and flowcharts. It defines algorithms as step-by-step solutions to problems and flowcharts as graphical representations of algorithms using standard symbols. It provides examples of pseudocode algorithms and corresponding flowcharts to calculate student grades, convert between feet and centimeters, and calculate rectangle area. The key flowchart symbols are defined including start/end, input/output, decision, and process symbols connected by flow lines.
The document provides an overview of computational thinking and problem solving. It discusses key concepts like algorithms, the building blocks of algorithms including statements, state, control flow, functions. It also covers different notations for representing algorithms - pseudocode, flowcharts, programming languages. Some key aspects covered include the definition of an algorithm, properties and qualities of a good algorithm. Examples are provided for different algorithm concepts like finding the minimum/maximum value, sorting cards etc.
This document discusses algorithms, flowcharts, and pseudocode. It provides examples of writing algorithms and creating flowcharts to solve problems like calculating a student's grade, converting feet to centimeters, and calculating the area of a rectangle. Key points covered include:
- Algorithms are step-by-step solutions to problems, while flowcharts use symbols to visually represent algorithm logic and flow.
- Pseudocode uses everyday language to describe algorithms before implementation in a programming language.
- Common flowchart symbols include rectangles, diamonds, circles, and arrows to show inputs, outputs, decisions, and flow.
- Examples demonstrate writing algorithms and creating corresponding flowcharts for simple problems like grade calculation and unit conversion.
The document discusses algorithms, flowcharts, and problem solving. It provides examples of writing pseudocode and algorithms to solve problems. It also explains the basic symbols used in flowcharts and provides examples of flowcharts. Key points include:
- Algorithms are step-by-step solutions to problems, while flowcharts show the logic visually using standard symbols.
- Pseudocode is an informal language similar to English that helps develop algorithms.
- Examples show algorithms and flowcharts for calculating grades, converting feet to centimeters, and finding the area of a rectangle.
- Standard flowchart symbols include shapes for start/end, processes, inputs/outputs, and decisions.
algorithms and flow chart overview.pdfAmanPratik11
This document discusses algorithms, flowcharts, and pseudocode. It provides examples of algorithms and flowcharts to calculate a student's grade, convert feet to centimeters, calculate the area of a rectangle, and find the roots of a quadratic equation. Algorithms are step-by-step solutions to problems, while flowcharts use graphical symbols to represent the logic and steps of an algorithm. Pseudocode is an informal language that helps develop algorithms. The document also lists common flowchart symbols and provides exercises to create algorithms and flowcharts.
The document discusses algorithms and flowcharts. It defines algorithms as step-by-step solutions to problems and flowcharts as graphical representations of algorithmic logic and control flow. The document provides examples of pseudocode algorithms and corresponding flowcharts for problems like calculating student grades, converting between units of measurement, and finding the roots of a quadratic equation. It also covers basic flowchart symbols and structures like IF/THEN/ELSE for modeling conditional logic.
This document discusses algorithms, flowcharts, pseudocode, and decision structures. It begins by defining algorithms and their purpose in problem solving. It then explains flowchart symbols and how to represent algorithms visually using flowcharts. Several examples are provided of writing pseudocode, detailed algorithms, and corresponding flowcharts to solve problems. The document also covers decision structures like if-then-else statements and relational operators. It provides examples of algorithms using nested if statements. Finally, it presents an example of determining an employee bonus based on overtime worked and absences.
The document introduces flowcharting and flowchart symbols. It defines a flowchart as a graphical representation of a process or program showing the steps as boxes of different shapes linked with arrows. The basic symbols are terminals (rounded rectangles for start/end), input/output operations (parallelograms), and processes (rectangles). An example flowchart calculates an employee's pay. There are four common structures: sequence, decision, repetition, and case. Connectors are used to split long flowcharts across pages.
The document discusses algorithms, flowcharts, and decision structures. It provides examples of writing pseudocode and algorithms to solve problems. It also explains how to represent algorithms visually using flowcharts. Key points include:
- An algorithm is a sequence of steps to solve a problem using a programming language.
- Pseudocode is an informal language similar to English used to develop algorithms.
- Flowcharts use symbols to represent program logic and the flow of data through a process.
- Decision structures like if-then-else statements allow programs to perform different actions based on conditional tests.
- Nested if statements allow multiple conditions to be checked sequentially.
The document discusses algorithms and flowcharts. It provides examples of writing pseudocode to represent algorithms, then refining the pseudocode into more detailed algorithms. It also explains how to represent algorithms visually using flowcharts. Various examples are given of writing algorithms and drawing corresponding flowcharts to solve problems like calculating student grades, converting between units of measurement, and finding the largest of three numbers. Decision structures like if-then-else statements and nested ifs are also covered.
An algorithm is a step-by-step process to solve a problem. It must be understandable by humans. The document provides examples of algorithms such as driving to a friend's house and grading systems. It also discusses flowcharts which use symbols to visually represent information flow in an algorithm. Examples are given to draw flowcharts for calculating rectangle area based on width and length, finding average marks of four subjects, and converting feet to centimeters.
The document discusses algorithms and flowcharts. It provides examples of writing algorithms to solve problems using pseudocode and representing the logic using flowcharts. Key points covered include:
- Algorithms are a sequence of steps to solve a problem while flowcharts show the logic visually
- Pseudocode is used to develop algorithms in a language similar to English
- Examples show algorithms and flowcharts for calculating grades, converting units, finding the largest number, and determining a bonus payment
- Decision structures like if-then-else are used to represent conditional logic in algorithms and flowcharts.
This document discusses algorithms and how to create good algorithms. It defines an algorithm as a step-by-step procedure to solve a problem. It lists properties of good algorithms as being simple, complete, correct, with appropriate abstraction and precision. The document provides examples of algorithms using pseudocode and discusses different types of algorithms like sequence, decision, and repetition. It also outlines the steps to create an algorithm as analyzing the problem, designing a solution, implementing the program, testing it, and validating it works under all circumstances.
The document discusses algorithms, flowcharts, pseudocode and different programming concepts like decision structures, loops, and problem solving approaches. It provides examples of writing algorithms and drawing flowcharts to solve problems like calculating grades, converting between units, finding the largest number among inputs, calculating powers and more. It also discusses using loops, decision structures, and other programming concepts to refine algorithms and make them more efficient. Pseudocode is presented as an informal way to develop algorithms before implementation.
The document discusses algorithms and their implementation in computer programs. It defines algorithms as step-by-step instructions to solve a problem and provides examples like recipes and driving directions. Computer algorithms are implemented as programs through programming languages. The document also discusses different types of control structures like sequential, selection, and iteration logic that are used to control the flow and logic of algorithms and programs.
Title: A Quick and Illustrated Guide to APA Style Referencing (7th Edition)
This visual and beginner-friendly guide simplifies the APA referencing style (7th edition) for academic writing. Designed especially for commerce students and research beginners, it includes:
✅ Real examples from original research papers
✅ Color-coded diagrams for clarity
✅ Key rules for in-text citation and reference list formatting
✅ Free citation tools like Mendeley & Zotero explained
Whether you're writing a college assignment, dissertation, or academic article, this guide will help you cite your sources correctly, confidently, and consistent.
Created by: Prof. Ishika Ghosh,
Faculty.
📩 For queries or feedback: [email protected]
Basic Slides on Algorithms and Flowchartsmoazwinner
This document discusses algorithms, flowcharts, and problem solving. It provides examples of writing pseudocode algorithms and creating corresponding flowcharts. Key points:
- Algorithms are step-by-step solutions to problems, while flowcharts use symbols to visually represent algorithm logic and flow.
- Pseudocode uses everyday language to describe algorithms before implementation.
- Common flowchart symbols include shapes for start/end, input/output, decisions, and processes connected by arrows showing flow.
- Examples show algorithms and flowcharts for calculating grades, converting units, finding a rectangle area, and other problems.
The document discusses algorithms and flowcharts. It defines algorithms as step-by-step solutions to problems and flowcharts as graphical representations of algorithms using standard symbols. It provides examples of pseudocode algorithms and corresponding flowcharts to calculate student grades, convert between feet and centimeters, and calculate rectangle area. The key flowchart symbols are defined including start/end, input/output, decision, and process symbols connected by flow lines.
The document provides an overview of computational thinking and problem solving. It discusses key concepts like algorithms, the building blocks of algorithms including statements, state, control flow, functions. It also covers different notations for representing algorithms - pseudocode, flowcharts, programming languages. Some key aspects covered include the definition of an algorithm, properties and qualities of a good algorithm. Examples are provided for different algorithm concepts like finding the minimum/maximum value, sorting cards etc.
This document discusses algorithms, flowcharts, and pseudocode. It provides examples of writing algorithms and creating flowcharts to solve problems like calculating a student's grade, converting feet to centimeters, and calculating the area of a rectangle. Key points covered include:
- Algorithms are step-by-step solutions to problems, while flowcharts use symbols to visually represent algorithm logic and flow.
- Pseudocode uses everyday language to describe algorithms before implementation in a programming language.
- Common flowchart symbols include rectangles, diamonds, circles, and arrows to show inputs, outputs, decisions, and flow.
- Examples demonstrate writing algorithms and creating corresponding flowcharts for simple problems like grade calculation and unit conversion.
The document discusses algorithms, flowcharts, and problem solving. It provides examples of writing pseudocode and algorithms to solve problems. It also explains the basic symbols used in flowcharts and provides examples of flowcharts. Key points include:
- Algorithms are step-by-step solutions to problems, while flowcharts show the logic visually using standard symbols.
- Pseudocode is an informal language similar to English that helps develop algorithms.
- Examples show algorithms and flowcharts for calculating grades, converting feet to centimeters, and finding the area of a rectangle.
- Standard flowchart symbols include shapes for start/end, processes, inputs/outputs, and decisions.
algorithms and flow chart overview.pdfAmanPratik11
This document discusses algorithms, flowcharts, and pseudocode. It provides examples of algorithms and flowcharts to calculate a student's grade, convert feet to centimeters, calculate the area of a rectangle, and find the roots of a quadratic equation. Algorithms are step-by-step solutions to problems, while flowcharts use graphical symbols to represent the logic and steps of an algorithm. Pseudocode is an informal language that helps develop algorithms. The document also lists common flowchart symbols and provides exercises to create algorithms and flowcharts.
The document discusses algorithms and flowcharts. It defines algorithms as step-by-step solutions to problems and flowcharts as graphical representations of algorithmic logic and control flow. The document provides examples of pseudocode algorithms and corresponding flowcharts for problems like calculating student grades, converting between units of measurement, and finding the roots of a quadratic equation. It also covers basic flowchart symbols and structures like IF/THEN/ELSE for modeling conditional logic.
This document discusses algorithms, flowcharts, pseudocode, and decision structures. It begins by defining algorithms and their purpose in problem solving. It then explains flowchart symbols and how to represent algorithms visually using flowcharts. Several examples are provided of writing pseudocode, detailed algorithms, and corresponding flowcharts to solve problems. The document also covers decision structures like if-then-else statements and relational operators. It provides examples of algorithms using nested if statements. Finally, it presents an example of determining an employee bonus based on overtime worked and absences.
The document introduces flowcharting and flowchart symbols. It defines a flowchart as a graphical representation of a process or program showing the steps as boxes of different shapes linked with arrows. The basic symbols are terminals (rounded rectangles for start/end), input/output operations (parallelograms), and processes (rectangles). An example flowchart calculates an employee's pay. There are four common structures: sequence, decision, repetition, and case. Connectors are used to split long flowcharts across pages.
The document discusses algorithms, flowcharts, and decision structures. It provides examples of writing pseudocode and algorithms to solve problems. It also explains how to represent algorithms visually using flowcharts. Key points include:
- An algorithm is a sequence of steps to solve a problem using a programming language.
- Pseudocode is an informal language similar to English used to develop algorithms.
- Flowcharts use symbols to represent program logic and the flow of data through a process.
- Decision structures like if-then-else statements allow programs to perform different actions based on conditional tests.
- Nested if statements allow multiple conditions to be checked sequentially.
The document discusses algorithms and flowcharts. It provides examples of writing pseudocode to represent algorithms, then refining the pseudocode into more detailed algorithms. It also explains how to represent algorithms visually using flowcharts. Various examples are given of writing algorithms and drawing corresponding flowcharts to solve problems like calculating student grades, converting between units of measurement, and finding the largest of three numbers. Decision structures like if-then-else statements and nested ifs are also covered.
An algorithm is a step-by-step process to solve a problem. It must be understandable by humans. The document provides examples of algorithms such as driving to a friend's house and grading systems. It also discusses flowcharts which use symbols to visually represent information flow in an algorithm. Examples are given to draw flowcharts for calculating rectangle area based on width and length, finding average marks of four subjects, and converting feet to centimeters.
The document discusses algorithms and flowcharts. It provides examples of writing algorithms to solve problems using pseudocode and representing the logic using flowcharts. Key points covered include:
- Algorithms are a sequence of steps to solve a problem while flowcharts show the logic visually
- Pseudocode is used to develop algorithms in a language similar to English
- Examples show algorithms and flowcharts for calculating grades, converting units, finding the largest number, and determining a bonus payment
- Decision structures like if-then-else are used to represent conditional logic in algorithms and flowcharts.
This document discusses algorithms and how to create good algorithms. It defines an algorithm as a step-by-step procedure to solve a problem. It lists properties of good algorithms as being simple, complete, correct, with appropriate abstraction and precision. The document provides examples of algorithms using pseudocode and discusses different types of algorithms like sequence, decision, and repetition. It also outlines the steps to create an algorithm as analyzing the problem, designing a solution, implementing the program, testing it, and validating it works under all circumstances.
The document discusses algorithms, flowcharts, pseudocode and different programming concepts like decision structures, loops, and problem solving approaches. It provides examples of writing algorithms and drawing flowcharts to solve problems like calculating grades, converting between units, finding the largest number among inputs, calculating powers and more. It also discusses using loops, decision structures, and other programming concepts to refine algorithms and make them more efficient. Pseudocode is presented as an informal way to develop algorithms before implementation.
The document discusses algorithms and their implementation in computer programs. It defines algorithms as step-by-step instructions to solve a problem and provides examples like recipes and driving directions. Computer algorithms are implemented as programs through programming languages. The document also discusses different types of control structures like sequential, selection, and iteration logic that are used to control the flow and logic of algorithms and programs.
Title: A Quick and Illustrated Guide to APA Style Referencing (7th Edition)
This visual and beginner-friendly guide simplifies the APA referencing style (7th edition) for academic writing. Designed especially for commerce students and research beginners, it includes:
✅ Real examples from original research papers
✅ Color-coded diagrams for clarity
✅ Key rules for in-text citation and reference list formatting
✅ Free citation tools like Mendeley & Zotero explained
Whether you're writing a college assignment, dissertation, or academic article, this guide will help you cite your sources correctly, confidently, and consistent.
Created by: Prof. Ishika Ghosh,
Faculty.
📩 For queries or feedback: [email protected]
A measles outbreak originating in West Texas has been linked to confirmed cases in New Mexico, with additional cases reported in Oklahoma and Kansas. The current case count is 795 from Texas, New Mexico, Oklahoma, and Kansas. 95 individuals have required hospitalization, and 3 deaths, 2 children in Texas and one adult in New Mexico. These fatalities mark the first measles-related deaths in the United States since 2015 and the first pediatric measles death since 2003.
The YSPH Virtual Medical Operations Center Briefs (VMOC) were created as a service-learning project by faculty and graduate students at the Yale School of Public Health in response to the 2010 Haiti Earthquake. Each year, the VMOC Briefs are produced by students enrolled in Environmental Health Science Course 581 - Public Health Emergencies: Disaster Planning and Response. These briefs compile diverse information sources – including status reports, maps, news articles, and web content– into a single, easily digestible document that can be widely shared and used interactively. Key features of this report include:
- Comprehensive Overview: Provides situation updates, maps, relevant news, and web resources.
- Accessibility: Designed for easy reading, wide distribution, and interactive use.
- Collaboration: The “unlocked" format enables other responders to share, copy, and adapt seamlessly. The students learn by doing, quickly discovering how and where to find critical information and presenting it in an easily understood manner.
pulse ppt.pptx Types of pulse , characteristics of pulse , Alteration of pulsesushreesangita003
what is pulse ?
Purpose
physiology and Regulation of pulse
Characteristics of pulse
factors affecting pulse
Sites of pulse
Alteration of pulse
for BSC Nursing 1st semester
for Gnm Nursing 1st year
Students .
vitalsign
How to Manage Opening & Closing Controls in Odoo 17 POSCeline George
In Odoo 17 Point of Sale, the opening and closing controls are key for cash management. At the start of a shift, cashiers log in and enter the starting cash amount, marking the beginning of financial tracking. Throughout the shift, every transaction is recorded, creating an audit trail.
Contact Lens:::: An Overview.pptx.: OptometryMushahidRaza8
A comprehensive guide for Optometry students: understanding in easy launguage of contact lens.
Don't forget to like,share and comments if you found it useful!.
"Basics of Heterocyclic Compounds and Their Naming Rules"rupalinirmalbpharm
This video is about heterocyclic compounds, which are chemical compounds with rings that include atoms like nitrogen, oxygen, or sulfur along with carbon. It covers:
Introduction – What heterocyclic compounds are.
Prefix for heteroatom – How to name the different non-carbon atoms in the ring.
Suffix for heterocyclic compounds – How to finish the name depending on the ring size and type.
Nomenclature rules – Simple rules for naming these compounds the right way.
Common rings – Examples of popular heterocyclic compounds used in real life.
Understanding P–N Junction Semiconductors: A Beginner’s GuideGS Virdi
Dive into the fundamentals of P–N junctions, the heart of every diode and semiconductor device. In this concise presentation, Dr. G.S. Virdi (Former Chief Scientist, CSIR-CEERI Pilani) covers:
What Is a P–N Junction? Learn how P-type and N-type materials join to create a diode.
Depletion Region & Biasing: See how forward and reverse bias shape the voltage–current behavior.
V–I Characteristics: Understand the curve that defines diode operation.
Real-World Uses: Discover common applications in rectifiers, signal clipping, and more.
Ideal for electronics students, hobbyists, and engineers seeking a clear, practical introduction to P–N junction semiconductors.
What makes space feel generous, and how architecture address this generosity in terms of atmosphere, metrics, and the implications of its scale? This edition of #Untagged explores these and other questions in its presentation of the 2024 edition of the Master in Collective Housing. The Master of Architecture in Collective Housing, MCH, is a postgraduate full-time international professional program of advanced architecture design in collective housing presented by Universidad Politécnica of Madrid (UPM) and Swiss Federal Institute of Technology (ETH).
Yearbook MCH 2024. Master in Advanced Studies in Collective Housing UPM - ETH
*Metamorphosis* is a biological process where an animal undergoes a dramatic transformation from a juvenile or larval stage to a adult stage, often involving significant changes in form and structure. This process is commonly seen in insects, amphibians, and some other animals.
2. What is Programming?
Series of instructions to a computer to
accomplish a task
Instructions must be written in a way the
computer can understand
Programming languages are used to write
programs
3. ALGORITHMS AND FLOWCHARTS
A typical programming task can be divided into
two phases:
Problem solving phase
produce an ordered sequence of steps that describe
solution of problem
this sequence of steps is called an algorithm
Implementation phase
implement the program in some programming
language
5. Steps in Problem Solving
First produce a general algorithm.
Refine the algorithm successively to get step by
step detailed algorithm that is very close to a
computer language.
Pseudocode is an artificial and informal
language that helps programmers develop
algorithms. Pseudocode is very similar to
everyday English.
6. Pseudocode & Algorithm
Example 1: Write an algorithm to
determine a student’s final grade and
indicate whether it is passing or failing.
The final grade is calculated as the
average of four marks.
Start with a general algorithm.
7. General Algorithm
Pseudocode:
Input a set of 4 marks
Calculate their average by summing and dividing
by 4
if average is below 50
Print “FAIL”
else
Print “PASS”
9. Task: add two numbers
Pseudocode:
Start
Get two numbers
Add them
Print the answer
End
10. Next Step - The Flowchart
A graphical representation of the sequence of
operations in an information system or program.
Information system flowcharts show how data flows from
source documents through the computer to final
distribution to users. Program flowcharts show the
sequence of instructions in a single program or
subroutine. Different symbols are used to draw each
type of flowchart.
The sequence of the flowchart and the algorithm MUST
match.
11. The Flowchart
A Flowchart
shows logic of an algorithm
emphasizes individual steps and their
interconnections
e.g. control flow from one action to the next
12. Flowchart Symbols
Basic
Oval
Parallelogram
Rectangle
Diamond
Hybrid
Name Symbol Use in Flowchart
Denotes the beginning or end of the program
Denotes an input operation
Denotes an output operation
Denotes a decision (or branch) to be made.
The program should continue along one of
two routes. (e.g. IF/THEN/ELSE)
Denotes a process to be carried out
e.g. addition, subtraction, division etc.
Flow line Denotes the direction of logic flow in the program
Module
Denotes a self-contained section of the
program
13. Example
PRINT
“PASS”
Step 1: Input M1,M2,M3,M4
Step 2: GRADE (M1+M2+M3+M4)/4
Step 3: if (GRADE <50) then
Print “FAIL”
else
Print “PASS”
endif
START
Input
M1,M2,M3,M4
GRADE(M1+M2+M3+M4)/4
IS
GRADE<50
PRINT
“FAIL”
STOP
Y
N
14. Control Structures
Represent the flow of logic through the programme.
There are four main control structures:
• Sequence
• Decision – incorporating if-then-else
• Repetition
• Case
15. Sequence Structure
• a series of actions are performed in sequence
START
Display message
“How many
hours did you
work?”
Read Hours
Display message
“How much do
you get paid per
hour?”
Read Pay Rate
Multiply Hours
by Pay Rate.
Store result in
Gross Pay.
Display Gross
Pay
END
This is the flowchart for a program which
calculates an employee’s gross pay.
16. Example 1
Write an algorithm and draw a flowchart to
convert the length in feet to centimetres.
Pseudocode:
Input the length in feet (Lft)
Calculate the length in cm (Lcm) by
multiplying LFT with 30
Print length in cm (LCM)
18. Example 2
Write an algorithm and draw a flowchart that
will read the two sides of a rectangle and
calculate its area.
Pseudocode
Input the width (W) and Length (L) of a rectangle
Calculate the area (A) by multiplying L with W
Print A
19. Example 2
Algorithm
Step 1: Input W,L
Step 2: A L x W
Step 3: Print A
START
Input
W, L
A L x W
STOP
Print
A
20. DECISION STRUCTURES
One of two possible actions is taken, depending
on a condition.
Decision Structure
A new symbol, the diamond, indicates a yes/no question.
23. 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
24. Decision Structure
Sometimes two choices are offered. If the answer to the
question is yes, the flow follows one path. If the answer
is no, the flow follows another path
YES
NO
25. Decision Structure
In the flowchart segment below, the question “is x < y?”
is asked. If the answer is no, then process A is
performed. If the answer is yes, then process B is
performed.
YES
NO
x < y
Process B
Process A
27. IF–THEN–ELSE STRUCTURE
The algorithm for the flowchart is as
follows:
If A>B then
print A
else
print B
is
A>B
Print
A
Print
B
N Y
28. Example 1
A ticket seller is issuing show tickets at the gate. When the patrons arrive,
he asks how old each one is. It they are under 12, they pay half price. If they
are 12 or over, they pay full price.
Algorithm
Get age
Age < 12?
If Age < 12
Then
Pay half price
Else
Pay full price
30. Example 2
Write an algorithm that reads two values, determines the
largest value and prints the largest value with an
identifying message.
ALGORITHM
Step 1: Input VALUE1, VALUE2
Step 2: if (VALUE1 > VALUE2) then
MAX VALUE1
else
MAX VALUE2
endif
Step 3: Print “The largest value is”, MAX
31. Example 2
MAX VALUE2
STOP
N Y
START
Input
VALUE1,VALUE2
MAX VALUE1
is
VALUE1>VALUE2
Print
MAX
32. Example 3
Write the algorithm and draw the flowchart
for the following:
Enter two numbers, x and y. If x is less
than y, square x to give the result a,
otherwise, add x + y to give the result a.
33. YES
NO
x < y
Calculate a
as x times 2.
Calculate a
as x plus y.
Algorithm
Input x
Input y
x < y?
If x <y
Then
a = x^
Else
a = x+y
34. NESTED IFS
One of the alternatives within an IF–
THEN–ELSE statement
may involve further IF–THEN–ELSE
statement
36. Repetition Structure
Repetition (Iteration) Structure
A repetition structure represents part of the program
that repeats. This type of structure is commonly
known as a loop.
37. Repetition Structure
Notice the use of the diamond symbol. A loop tests a
condition, and if the condition exists, it performs an
action. Then it tests the condition again. If the
condition still exists, the action is repeated. This
continues until the condition no longer exists.
38. Repetition Structure
In the flowchart segment, the question “is x < y?”
is asked. If the answer is yes, then Process A is
performed. The question “is x < y?” is asked
again. Process A is repeated as long as x is less
than y. When x is no longer less than y, the
repetition stops and the structure is exited.
x < y Process A
YES
39. x < y Add 1 to x
YES
So this might look like…
When would this loop exit?
40. The action performed by a repetition structure must eventually cause the loop to
terminate. Otherwise, an infinite loop is created.
In this flowchart segment, x is never changed. Once the loop starts, it will never
end.
QUESTION: How can this flowchart be modified so it is no longer an infinite
loop?
Out of Control!
x < y Display x
YES
41. This type of structure is known as a pre-test
repetition structure. The condition is tested
BEFORE any actions are performed.
Pre-test ( Before) Loop
x < y? Display x
Add 1 to x
YES
42. Post-test (After) Loop
This flowchart segment shows a
post-test repetition structure.
The condition is tested AFTER
the actions are performed.
A post-test repetition structure
always performs its actions at
least once.
Display x
Add 1 to x
YES
x < y
43. Case Structure
One of several possible actions is taken, depending on
the contents of a variable.
Used for MORE THAN TWO decisions
44. The structure below indicates actions to
perform depending on the value in
years_employed.
CASE
years_employed
1 2 3 Other
bonus = 100 bonus = 200 bonus = 400 bonus = 800
45. CASE
years_employed
1 2 3 Other
bonus = 100 bonus = 200 bonus = 400 bonus = 800
If years_employed = 1,
bonus is set to 100
If years_employed = 2,
bonus is set to 200
If years_employed = 3,
bonus is set to 400
If years_employed is
any other value, bonus
is set to 800
46. Case Algorithm
Input a Grade
Case based on Grade
Case =100
Report “Perfect Score” (or suitable command eg Grade = Perfect)
Case > 89
Report “Grade = A”
Case > 79
Report “Grade = B”
Case > 69
Report “Grade = C”
Case > 59
Report “Grade = D”
Default (or Else)
Report “Grade = F”
End Case
Draw the Flowchart for the above example
47. CASE
grade
>89 >79 >69 > 59
Grade =A Grade = B Grade = C Grade = D
Flowchart
Grade = Perfect Grade = F
100 other
48. Construct the algorithm and the flowchart for the
following procedure:
An egg packing business needs to devise a
process to sort eggs for delivery to supermarkets.
If the eggs weigh 50 grams, they are Class A
eggs. If they weigh 60 grams, they are Class B
eggs. If they weigh 70 grams, they are Class C
eggs. If they weigh more than 70 grams, they are
Class D eggs.
49. Input a Weight
Case based on Weight
Case =50
Class = A
Case =60
Class = B
Case = 70
Class = C
Case > 70
Class = D
OR
Default/ Else Class = D
End Case
Algorithm
CASE
weight
50 60 70 > 70
Class =A Class = B Class = C Class = D
Flowchart
50. Modules (stepwise refinement)
A program module is a part of a program that
makes sense on its own, just like a paragraph
in an essay should make sense on its own. In
large programs, such as those used in
industry, programs are developed as
separate modules and then put together.
The process of representing modules in
flowcharts is known as stepwise refinement.
You will look at this more closely when you
start programming.
51. •The position of the module
symbol indicates the point the
module is executed.
•A separate flowchart can be
constructed for the module.
START
END
Read Input.
Call calc_pay
function.
Display results.
START
Display message
“How many
hours did you
work?”
Read Hours
Display message
“How much do
you get paid per
hour?”
Read Pay Rate
Multiply Hours
by Pay Rate.
Store result in
Gross Pay.
Display Gross
Pay
END
52. A simpler example… could look like
CASE
weight
50 60 70 > 70
Class =A Class = B Class = C Class =
D
Input weight
Calculate class
Display class
53. A complete program example
When you use stepwise refinement, the complete, refined flowchart is drawn first.
Then the modules are named and drawn in order.
This program lists the AFL team name and points total for all teams that have a full-forward from the AFL competition
who has kicked at least 10 goals.