[go: up one dir, main page]

0% found this document useful (0 votes)
15 views6 pages

FLOWCHART

Uploaded by

Deepika
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
15 views6 pages

FLOWCHART

Uploaded by

Deepika
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 6

FLOWC HARTS

 A flowchart is a pictorial or graphical representation of an algorithm.


 It consists sequences of instructions that are carried out in an algorithm.
 The shapes represent operations.
 Arrows represent the sequence or flow in which these operations are carried out.
 It is mainly used to help the programmer to understand the logic of the program.
Notations used in flowchart

Shape Name Meaning


Start and Stop Used to denote start and stop of flowchart
Parallelogram used to read input and display
Input and Output
output
Rectangle used to include instructions or
Processing
processing statements
To include decision making statements rhombus
Decision/ Condition
is used
Connector Join different flow chart or flow lines
Repetition/ Loop Hexagon is used for looping constructs
To include functions in a program, the name of
Functions
function should be enclosed within the figure

Control Flow Lines Arrows denoting flow of control in flow chart

For including the comments, definition or


Comment box
explanation
Ex 1. Algorithm and Flowchart to Input the dimensions of a rectangle and print area and perimeter

Step 1: Start
Step 2: Read length, breadth
Step 3: area  length * breadth
Step 4: Compute ‘perimeter’
Step 5: Perimeter2*(length+breadth)
Step 6: Display area, perimeter
Step 7: stop
Ex 2. Algorithm and Flowchart to Input 3 numbers and print the biggest number.

Step 1: start
Step 2: input a,b,c
Step 3: if a>b
bigaba
else
bigabb
end if

Step 4: if c>bigab
display c
else
display bigab
end if
Step 5: stop
Advantages of the Flow Chart
 The flowchart is a good way of conveying the logic of the system.
 Facilitates the analysis of the problem.
 Provides a proper documentation.
 Easy identification of the errors and bugs.
 It directs the program development.
 Maintenance of the program becomes easy. 

Disadvantages of the Flow Chart


 The complex logic could result in the complex flow chart.
 A flowchart must be recreated to employ modification and alterations.

Differences between Algorithm and Flowchart:

BASIS FOR COMPARISON ALGORITHM FLOW CHART

Basic Includes sequence of steps which depicts the An information diagram made up of
procedure of the solution. different shapes shows the data flow.

Comprehensibility Hard to understand Easily interpreted

Uses Text Symbols

Implements No rules are employed. Predefined rules are implemented.

Debugging Easier Difficult

Ease of construction Perplexing Simple

Key Differences between Algorithm and Flowchart


[1]. An algorithm involves a combination of sequential steps to interpret the logic of the solution. In
contrast, a flowchart is the pictorial illustration of the algorithm.
[2]. A flow chart is more understandable as compared to the algorithm.
[3]. The algorithm is written in a language that can be perceived by humans. On the other hand, the
flowchart is made up using different shapes and symbols.
[4]. There are no stringent rules are implemented in the algorithms while the flowchart is abode by
predefined rules.
[5]. Errors and bugs are easily detected in the algorithm as compared to the flow charts.
[6]. Flow charts are simple to create. On the contrary, the construction of the algorithm is complex.
Exercise:
Construct a Flowchart for the following:
1. Addition, Multiplication, Subtraction of two numbers.
2. Swapping of two numbers:
a. Using temporary variable.
b. Without using temporary variable.
3. Area of Triangle, Rectangle, Square, Circle.
4. Calculate Simple Interest.
5. Area of Triangle when three sides are given.
6. Circumference of Circle.
7. Perimeter of the Rectangle.
8. Greatest of two numbers.
9. Number is Even or Odd.
10. Number is Positive or Negative.
11. To find sum and average of 3 numbers.
12. To check the character is Alphabet or Not.
13. Develop a calculator to convert time, distance, area, volume and temperature from one unit to
another.
14. Calculate simple and compound interest for various parameters specified by the user.
15. Enter marks of five subjects and calculate total, average and percentage.
16. Calculate net salary of employee given basic, da, hra, pf and lic.
17. Retrieve remainder after division of two numbers without using mod operator.
18. Convert an upper-case character to a lower-case character.
19. Swap two numbers using Temp variable and without using Temp variable.
20. Enter two angles of a triangle and find the third angle.
21. Check Least Significant Bit (LSB) of a number
22. Input any number from user and check whether nth bit of the given number is set (1) or not
(0)(hint: Use bitwise operators)
Problem Solving and Programming with C GITAM

Note:
1. Need for writing algorithm and flow charts
 Effective communication
 Effective analysis
 Effective coding
 Effective debugging
 Easy maintenance
 Proper documentation

2. Pseudocode: A solution to Problem


 It is the first step in writing a program.
 It is written using a mixture of English and C language.
 It is a series of steps to solve a given problem
 It acts as a problem solving tool

Ex 1: Addition of two numbers Ex 2: Area of Circle


Get the numbers[a,b] Get the radius[r]
Compute addition [Sum= a + b] Compute area[Area = 3.141*r*r]
Print the results [Sum]Print the results [Area]
Advantage:
 Easy to write and understand
 It is relatively easy to convert English description solution of small programs to C program.
Disadvantage:
 It is very difficult to translate the solution of lengthy and complex problem in English to C

4 Department of Computer Science and Engineering, GST

You might also like