Introduction to Flowchart
What Is a Flowchart?
A flowchart is a graphical representation of an algorithm. It uses standard symbols connected by arrows to show the sequence of steps required to solve a problem.
Flowcharts help us understand the logic of a solution before writing a program.
Common Flowchart Symbols
Different symbols represent different operations in a flowchart. The following symbols are commonly used.
1. Terminal
Shape: Oval
Indicates the beginning or end of a flowchart.
Example: Start, Stop
2. Input / Output
Shape: Parallelogram
Accepts input or displays output.
Example: Read A, Display SUM
3. Process
Shape: Rectangle
Represents a calculation or processing operation.
Example: SUM = A + B
4. Decision
Shape: Diamond
Checks a condition and branches based on its result.
Example: Is A > B?
5. Flow Line
Shape: Arrow
Shows the direction and sequence of execution.
Example: Connects two steps
6. Connector
Shape: Circle
Connects different parts of a flowchart.
Example: Connector A
Example: Flowchart to Add Two Numbers
Problem: Find the sum of two numbers.
Algorithm
An algorithm is a finite sequence of clear, ordered steps used to solve a problem.
- Start.
- Read the first number A.
- Read the second number B.
- Add A and B and store the result in SUM.
- Display SUM.
- Stop.
These steps describe the solution in simple English. They are algorithm steps, not pseudocode.
Flowchart Diagram
Follow the arrows from Start to Stop to understand the sequence of operations.
Explanation of the Flowchart
- Start: The oval indicates the beginning of the flowchart.
- Read A, B: The parallelogram represents input. The two numbers are accepted.
- SUM = A + B: The rectangle represents processing. The two numbers are added.
- Display SUM: The parallelogram represents output. The sum is displayed.
- Stop: The oval indicates the end of the flowchart.
Example: Flowchart to Find the Larger of Two Numbers
Problem: Find the larger of two numbers.
This example introduces the decision symbol (diamond). Instead of a single sequence of steps, the flowchart branches into two possible paths and both paths join again at the end.
Algorithm
- Start.
- Read the first number A.
- Read the second number B.
- If A is greater than B, display A as the larger number.
- Otherwise, display B as the larger number.
- Stop.
Flowchart Diagram
Follow the arrows from Start. At the diamond, the flow splits into a Yes path and a No path, and both paths meet again before Stop.
Explanation of the Flowchart
- Start: The oval indicates the beginning of the flowchart.
- Read A, B: The parallelogram represents input. The two numbers are accepted.
- Is A > B?: The diamond represents a decision. It checks the condition and branches the flow into a Yes path and a No path.
- Display A (Yes path): If the condition A > B is true, the parallelogram displays A as the larger number.
- Display B (No path): If the condition A > B is false, the parallelogram displays B as the larger number.
- Stop: The oval indicates the end of the flowchart. Both the Yes path and the No path join here.
Advantages of Flowcharts
- Easy to understand the logic of a problem.
- Shows the sequence of operations visually.
- Helps identify logical errors before coding.
- Improves communication and documentation.
- Makes program planning easier.
Limitations of Flowcharts
- Large flowcharts can become difficult to understand.
- Modifying a flowchart may require redrawing parts of it.
- Preparing detailed flowcharts can take time.
Quick Revision
- Oval: Start or Stop.
- Parallelogram: Input or Output.
- Rectangle: Processing or calculation.
- Diamond: Decision or condition.
- Arrow: Direction of flow.
- Circle: Connector.