Professional Documents
Culture Documents
CH 1
CH 1
Else
Display b is greater
• Step 5: Stop
An algorithm to find largest among
three numbers
• Step 1: Start
• Step 2: Declare variable a, b and c
• Step 3: Read variable a, b and c
• Step 4: If a>b
If a>c
Display a is greater
Else
Display c is greater
Else
If b>c
Display b is greater
Else
Display c is greater
• Step 5: Stop
b) Flowchart
• Flowchart is the pictorial or graphical
representation of step by step procedure of a
problem to be solved.
• A flowchart show the actual flow of the logic
of a program.
• It is made up of symbols for various types of
operations used in the program.
Various symbols are used to draw
flowchart are-
• Terminal
• Input and Output
• Processing
• Flow lines
• Decision symbol
• Connectors
1. Terminals
• This symbol represents the beginning and end
point of the flowchart.
• The shape of terminal symbol is in oval shape.
• Used as first or last symbol in a program to
start and end the flowchart.
Start
Stop
2.Input and Output Symbol
• This symbol is used to enter data from
keyboard or to print the result on screen.
Input a , b Print c
3.Processing
• This symbol is used to represent any kind of
processing activity i.e. calculations and
arithmetic operation.
C=A+B
4. Flow Lines
• This symbol is used to show flow of data from
one point to another.
• The flow lines with arrow heads are used to
indicate the flow of operation.
• Arrow coming from one symbol and end at
another symbol.
5.Decision symbol
• This symbol is used where a decision has to be
made in selecting the different paths to be
followed.
• In this there is only one entry point and at
least two exist point.
Yes Is no
(A>B)?
6.Connectors
• This symbol is used to connect the various
position of the flow chart.
• This is normally used when the flowchart is
divided into two pages.
Limitations of Flowcharts
• It is time consuming process.
• It is difficult to draw with proper symbol.
• If little modification is required then we have
redraw the entire flowchart.
Draw a flowchart to add two numbers
Start
Input A,B
C=A+B
Print C
Stop
Draw a flowchart to find largest among two numbers
Start
Input A,B
yes Is no
(A>B)?
Print A Print B
Stop
Draw a flowchart to find largest among three numbers
Start
Input A,B
and C
Stop
c) Pseudo code
• It is a code which is written in English form to
solve a particular problem.
• It can have the same style and format of the
language but ignores the most punctuations.
• For example- Pseudo code for printing the bigger
out of two numbers.
{
integer a , b
read a , b
If a is greater than b
then print a
else print b
}
Advantages and Disadvantages of
Pseudo code
Advantages Disadvantages
• It is very easy to covert a • There are no standard rules to
pseudo code into follow in pseudo codes.
programming language
• In case of change in the • There is no graphical
program, pseudo code are representation.
easy to modify.
• It is very helpful tool. • It is time consuming and
lengthy.
3. Coding
• After the successful completion of second phase i.e
selection of algorithm or flowchart, it must be
converted into a form that can be used by a
computer.
• The programmer translates the steps of algorithm or
flowchart in a computer program using a language
such as C is called as Coding.
Translate into a
Algorithm/ computer
Problem Flowchart Program i.e
Program
(input) Coding
Read n
i=1
fact=n
Is i<n?
fact=fact*1
Print fact
i=i+1
Stop