what is Flowchart in C?

A flowchart is a graphical or pictorial representation of the logic for solving a given problem. The flowchart in C can also be defined as “a step by step diagrammatic representation of the logical steps to solve a given problem”.

A flowchart is “visual or graphical representation of an algorithm”.

The flowchart in C is a pictorial representation of the methods to be used to solve a given problem and help a great deal to analyse the problem and plan its solution in a systematic and orderly manner.

The flowchart uses different symbols to design a solution to a problem. It is another commonly used programming tool.

By looking at the flowchart one can understand the operations and sequence of operations performed in a system. It is also considered as a blueprint of a design used for solving a specific problem.

Symbols or Notations in Flowchart

Flowcharts are constructed or designed by using special geometrical symbols. Each symbol represents an activity. The activity could be input/output of data, computation or processing of data, making a decision, terminating the solution, flow of data and so on.

The symbols that we are using while drawing flowcharts are as given below as per conventions followed by the International Standard Organization(ISO).

1. Terminal:

flowchart in c

It is used to represent the START and END i.e stop of the flowchart.


2. Input or Output:

flowchart in c

Used for input and output Operations.


3. Process:

flowchart in c

Used for Arithmetic operations and data manipulations.


4. Decision:

flowchart in c

Used to Represent the operation in which there are two or three alternatives i.e true or false etc.


5. Flow Lines:

flow lines

Used to indicate the direction of the flow or logic by connecting symbols.


6. Connector:

connector

Used to join the different parts of a flowchart.


7. Off Page Connector:

off page connector

Represents a break in the path of flowchart which is too large to fit on a single page.


8. Predefined Process or Function:

predefined process

Used to Invoke a subroutine or an interrupt program.

General Rules For Drawing Flowcharts

Flow Charts are drawn using slandered flowchart symbols. While drawing flowchart some guideline to be followed. Below are some guidelines for a flowchart:

First of all list all necessary requirements in a logical order.

The flowchart should be clear and easy to understand. There should not be any ambiguity in understanding the flowchart. For doing this it is necessary to have all the steps and operation very simple.

Usually, the direction of the flow of data or procedure in the system should be from left to right or top to bottom.

Only one flow line should come out from a process symbol.

In the case of use of decision symbol, only one flow line should enter to it, but there may be two or three flow lines coming out of the decision symbol, one for each possible answer.

In a flowchart, only one flow line should come out to the end symbol.

While writing steps inside the processing symbol, steps should be brief and if necessary, you can use the annotation symbol to describe data or processing one steps more clearly.

In the case of complex flowchart symbols to be used for reducing the number of flow lines in the flowchart.

The intersection of flow lines should be avoided to make a flowchart more effective and for a better way of communication.

A flowchart must have a logical start and end.

Once, a flowchart is drawn its validity should be tested by passing through it with a simple set of test data.

Examples of Algorithm in C

Let us see some simple examples of the flowchart.

1st Example: To find the sum of two numbers.

find sum of two numbers

2nd Example: To find Area and Perimeter of Rectangle.

area of rectangle

3rd Example: To convert Temperature from Fahrenheit to Celsius.

celsius

4th Example: To find smallest of Two Numbers.

smallest of two numbers

5th Example: To find the sum of first n Natural Numbers.

sum of first n natural numbers flowchart

Advantages and Disadvantages of Flowchart in C

Advantages of Flowcharts:

1. Better Communication:

A flowchart can be used as a better way of communication of the logic of a system and steps involved in the solution.

2. Effective Analysis:

A flowchart of a problem can be used for effective analysis of the problem.

3. Documentation of Program or System:

Program flowcharts are a vital part of good program documentation. Program document is used for various purpose like knowing the components in the program, complexity of the program etc.

4. Coding of the Program:

Any design of the solution of a problem is finally converted into a computer program. Writing code becomes easy by referring to the flowchart of the solution.

5. Systematic Debugging:

A flowchart is very helpful in detecting, locating and removing mistakes in a program in a systematic manner because programmers find it easier to follow the logic of the program in flowchart form.

6. Efficient Program Maintenance:

Once, a program is developed and becomes operational it needs time to time maintenance to become easier.

7. Simplify the Logic:

As flowchart provides the pictorial representation of the steps therefore, it simplifies the logic and subsequent steps.

Disadvantages of Flowcharts:

1. Complex Logic:

Sometimes for large problems, the program logic is quite complicated. In that case, the flow chart becomes complex and clumsy.

2. Time Consuming:

Flowcharts are very time consuming and laborious to draw with proper symbols and spacing, especially for large complex programs.

3. Alterations and Modifications:

If alterations are required in the flow chart, it may require redrawing of it completely.

4. Reproduction:

As the flow chart symbols cannot be typed, reproduction of flow chart becomes a major problem.

5. No Standard:

There are no standards determining the amount of detail that should be included in the flowchart.

Difference Between Algorithm and Flowchart in C

The following table compares the algorithm and flowchart in C:

SR.NOAlgorithmFlowchart
1.Algorithm is method of representing
Step by step logical procedure for solving a problem.
Flowchart is diagrammatic or pictorial representation of an Algorithm
2.It contains simple english statements.It is constructed using different types of symbols.
3.as compared to flowchart, less time consuming and less laborious.Flowcharts are very time consuming and laborious to draw with proper symbols and spacing, especially for large complex programs.
4.Modification in algorithm is easy.Modification in the flowchart may require redrawing.
5.It is difficult to show branching and looping.It is easy to show branching and looping.
6.Debugging is difficult in complex problems.Debugging is easy as comparative to the algorithm for complex problems.