Flowchart
Flowchart
Learn what a flowchart is, why programmers use flowcharts, common flowchart symbols, and how flowcharts help represent algorithms visually before writing actual code.
What is a Flowchart?
A flowchart is a visual diagram that represents the steps of an algorithm, process, or program logic. It uses different shapes and arrows to show how a program starts, accepts input, performs processing, makes decisions, displays output, and ends.
In programming, a flowchart helps students understand how a solution works before writing actual code. It shows the sequence of operations in a clear and visual way, making it easier to identify the logic of a program.
Flowcharts are especially useful for beginners because they help convert a problem statement into a clear structure. Instead of reading long paragraphs, students can follow the arrows and understand how the program moves from one step to another.
Easy Real-Life Example
Flowchart as a Road Map
Think of a flowchart like a road map. A road map shows where to start, which road to follow, where to turn, and where the journey ends. Similarly, a flowchart shows where a program starts, what steps it follows, where decisions are made, and where the program ends.
In programming, the destination is the correct output, and the flowchart shows how to reach that output logically.
Why Do We Need Flowcharts?
Flowcharts are needed because they help students and programmers visualize program logic. A flowchart makes it easier to understand the order of steps, decisions, loops, and outputs before coding begins.
Importance of Flowcharts
- They help visualize program logic clearly.
- They make algorithms easier to understand.
- They help identify input, process, decision, and output steps.
- They reduce confusion before writing code.
- They help explain logic to beginners and non-programmers.
- They support debugging by showing the flow of execution.
- They are useful in exams, assignments, project planning, and documentation.
- They help convert problem statements into structured solutions.
Algorithm vs Pseudocode vs Flowchart
Algorithms, pseudocode, and flowcharts are all used for program planning, but they represent logic in different ways.
| Concept | Meaning | Representation Style |
|---|---|---|
| Algorithm | A step-by-step method to solve a problem. | Plain logical steps. |
| Pseudocode | English-like structure used to describe program logic. | Text-based planning. |
| Flowchart | A diagram that visually represents the steps of an algorithm. | Symbols and arrows. |
Common Flowchart Symbols
Flowcharts use standard symbols to represent different types of operations. Each symbol has a specific meaning.
| Symbol Name | Shape | Purpose | Example Text Inside Symbol |
|---|---|---|---|
| Terminator | Oval | Shows the start or end of a flowchart. | Start / End |
| Input / Output | Parallelogram | Shows data input or output operation. | Input marks / Display result |
| Process | Rectangle | Shows calculation, assignment, or processing step. | sum = a + b |
| Decision | Diamond | Shows a condition with possible branches. | marks >= 35? |
| Flow Line | Arrow | Shows the direction of flow. | Moves from one step to another. |
| Connector | Small Circle | Connects different parts of a flowchart. | A, B, C |
Basic Flowchart Structure
Most beginner flowcharts follow a simple structure: start, input, process, output, and end.
This structure is useful for simple programs such as adding two numbers, calculating average marks, finding area, calculating total price, or converting temperature.
Basic Control Structures in Flowcharts
Flowcharts commonly represent three basic programming control structures: sequence, selection, and repetition.
Sequence
Steps are executed one after another.
In sequence flow, the program moves from one step to the next in a straight order. Example: input two numbers, add them, and display the result.
Selection
A decision is made using a condition.
In selection flow, the program checks a condition and follows different paths depending on whether the condition is true or false.
Repetition
Steps are repeated using a loop.
In repetition flow, one or more steps are repeated until a condition becomes false or a target count is reached.
Example 1: Flowchart to Add Two Numbers
Problem Statement
IPO Analysis
| IPO Part | Details |
|---|---|
| Input | Two numbers: number1 and number2. |
| Process | Add both numbers: sum = number1 + number2. |
| Output | Display the sum. |
Flowchart Steps
Step-by-Step Flow
- Start.
- Input first number.
- Input second number.
- Add both numbers.
- Display sum.
- End.
Text-Based Flowchart Representation
┌─────────┐
│ Start │
└────┬────┘
│
▼
┌───────────────┐
│ Input number1 │
└───────┬───────┘
│
▼
┌───────────────┐
│ Input number2 │
└───────┬───────┘
│
▼
┌─────────────────────────┐
│ sum = number1 + number2 │
└───────────┬─────────────┘
│
▼
┌─────────────┐
│ Display sum │
└──────┬──────┘
│
▼
┌─────┐
│ End │
└─────┘
Pseudocode
START
INPUT number1
INPUT number2
SET sum = number1 + number2
DISPLAY sum
END
Java Code
public class Main {
public static void main(String[] args) {
int number1 = 10;
int number2 = 20;
int sum = number1 + number2;
System.out.println("Sum: " + sum);
}
}
Example 2: Flowchart to Check Pass or Fail
Problem Statement
IPO Analysis
| IPO Part | Details |
|---|---|
| Input | Student marks. |
| Process | Check whether marks are greater than or equal to 35. |
| Output | Display Pass or Fail. |
Text-Based Flowchart Representation
┌─────────┐
│ Start │
└────┬────┘
│
▼
┌─────────────┐
│ Input marks │
└──────┬──────┘
│
▼
┌───────────────┐
│ marks >= 35 ? │
└──────┬────────┘
Yes │ No
│
┌───────▼───────┐ ┌──────────────┐
│ Display Pass │ │ Display Fail │
└───────┬───────┘ └──────┬───────┘
│ │
└──────────┬──────────┘
▼
┌─────┐
│ End │
└─────┘
Pseudocode
START
INPUT marks
IF marks >= 35 THEN
DISPLAY "Pass"
ELSE
DISPLAY "Fail"
END IF
END
Java Code
public class Main {
public static void main(String[] args) {
int marks = 40;
if (marks >= 35) {
System.out.println("Pass");
} else {
System.out.println("Fail");
}
}
}
Example 3: Flowchart to Print Numbers from 1 to 5
Problem Statement
Text-Based Flowchart Representation
┌─────────┐
│ Start │
└────┬────┘
│
▼
┌───────────┐
│ i = 1 │
└────┬──────┘
│
▼
┌───────────┐
│ i <= 5 ? │
└────┬──────┘
Yes │ No
│
▼
┌─────────────┐
│ Display i │
└──────┬──────┘
│
▼
┌───────────┐
│ i = i + 1 │
└────┬──────┘
│
└───────────────┐
▼
i <= 5 ?
No path goes to:
┌─────┐
│ End │
└─────┘
Pseudocode
START
SET i = 1
WHILE i <= 5 DO
DISPLAY i
SET i = i + 1
END WHILE
END
Java Code
public class Main {
public static void main(String[] args) {
int i = 1;
while (i <= 5) {
System.out.println(i);
i++;
}
}
}
Example 4: Flowchart to Find Largest of Three Numbers
Problem Statement
Pseudocode
START
INPUT A
INPUT B
INPUT C
SET max = A
IF B > max THEN
SET max = B
END IF
IF C > max THEN
SET max = C
END IF
DISPLAY max
END
Text-Based Flowchart Representation
┌─────────┐
│ Start │
└────┬────┘
│
▼
┌────────────────┐
│ Input A, B, C │
└───────┬────────┘
│
▼
┌─────────┐
│ max = A │
└────┬────┘
│
▼
┌─────────┐
│ B > max?│
└────┬────┘
Yes │ No
│
▼
┌─────────┐
│ max = B │
└────┬────┘
│
▼
┌─────────┐
│ C > max?│
└────┬────┘
Yes │ No
│
▼
┌─────────┐
│ max = C │
└────┬────┘
│
▼
┌─────────────┐
│ Display max │
└──────┬──────┘
│
▼
┌─────┐
│ End │
└─────┘
Java Code
public class Main {
public static void main(String[] args) {
int a = 10;
int b = 25;
int c = 15;
int max = a;
if (b > max) {
max = b;
}
if (c > max) {
max = c;
}
System.out.println("Largest Number: " + max);
}
}
Rules for Drawing a Good Flowchart
A flowchart should be neat, logical, and easy to follow. Good flowcharts help students understand the logic quickly.
Recommended Rules
- Always start with a Start symbol.
- Always end with an End symbol.
- Use correct symbols for input, process, decision, and output.
- Connect symbols using arrows.
- Show the flow direction clearly.
- Write short and meaningful text inside symbols.
- Use Yes and No labels for decision branches.
- Avoid crossing arrows unnecessarily.
- Keep the flowchart clean and readable.
- Check whether every path reaches the End symbol.
Decision Symbols in Flowcharts
A decision symbol is used when the program needs to choose between two or more paths. It is usually represented by a diamond shape.
Decision Example
Condition:
marks >= 35?
If Yes:
Display "Pass"
If No:
Display "Fail"
Decision symbols are important because many programs depend on conditions, such as checking pass/fail, even/odd, eligibility, login success, or discount availability.
Loops in Flowcharts
A loop in a flowchart shows that some steps are repeated while a condition remains true. Loops are useful for repeated tasks such as printing numbers, calculating totals, reading lists, or processing records.
Loop Logic Example
SET i = 1
WHILE i <= 5
DISPLAY i
SET i = i + 1
END WHILE
In a flowchart, the condition is placed inside a decision symbol. If the condition is true, the flow repeats. If the condition is false, the loop ends.
Flowchart vs Pseudocode
Both flowcharts and pseudocode are used before coding. The difference is in how they represent logic.
| Flowchart | Pseudocode |
|---|---|
| Uses symbols and arrows. | Uses English-like statements. |
| Visual representation of logic. | Text-based representation of logic. |
| Good for visual understanding. | Good for writing detailed program logic. |
| Can become large for complex problems. | Usually easier to write for longer logic. |
| Useful for explaining flow to beginners. | Useful for converting logic into code. |
How Flowcharts Help Debugging
Flowcharts help debugging because they show the flow of logic visually. If a program gives wrong output, students can check the flowchart to find whether the mistake is in input, processing, decision, loop, or output.
Debugging Questions Using Flowchart
- Does the flowchart start correctly?
- Is input shown clearly?
- Is the process formula correct?
- Are decision conditions correct?
- Are Yes and No branches correctly labeled?
- Does the loop stop properly?
- Is the expected output displayed?
- Does every path reach the End symbol?
Prerequisites Before Learning Flowcharts
Flowcharts are beginner-friendly, but students should understand basic problem-solving and programming concepts to draw them properly.
Basic Prerequisites
- Basic understanding of what programming is.
- Understanding of input, process, and output.
- Basic understanding of algorithms.
- Basic understanding of pseudocode.
- Knowledge of variables and operators.
- Understanding of conditions such as
ifandelse. - Understanding of loops such as
whileandfor. - Logical thinking and problem-solving mindset.
Common Beginner Mistakes
Mistakes
- Using the wrong symbol for a step.
- Forgetting the Start or End symbol.
- Not connecting symbols with arrows.
- Writing too much text inside a symbol.
- Not labeling decision branches as Yes or No.
- Creating arrows that confuse the flow.
- Forgetting to show output.
- Creating loops that never stop.
Better Habits
- Use standard flowchart symbols.
- Keep the flow direction clear.
- Use short and meaningful labels.
- Clearly show input, process, decision, and output.
- Label decision arrows properly.
- Make sure every path reaches End.
- Use connectors for large diagrams.
- Test the flowchart using sample input values.
Practice Activity: Draw a Flowchart
This activity helps students practice creating a flowchart from a problem statement.
Problem Statement
IPO Analysis
| IPO Part | Answer |
|---|---|
| Input | Length and width. |
| Process | area = length * width |
| Output | Area of rectangle. |
Text-Based Flowchart Solution
┌─────────┐
│ Start │
└────┬────┘
│
▼
┌────────────────┐
│ Input length │
└───────┬────────┘
│
▼
┌────────────────┐
│ Input width │
└───────┬────────┘
│
▼
┌─────────────────────┐
│ area = length*width │
└─────────┬───────────┘
│
▼
┌──────────────┐
│ Display area │
└──────┬───────┘
│
▼
┌─────┐
│ End │
└─────┘
Pseudocode
START
INPUT length
INPUT width
SET area = length * width
DISPLAY area
END
Java Solution
public class Main {
public static void main(String[] args) {
int length = 10;
int width = 5;
int area = length * width;
System.out.println("Area of Rectangle: " + area);
}
}
Mini Quiz
What is a flowchart?
A flowchart is a visual representation of an algorithm or process using symbols and arrows.
Which symbol is used for Start and End?
The oval or terminator symbol is used for Start and End.
Which symbol is used for input and output?
The parallelogram symbol is used for input and output.
Which symbol is used for a decision?
The diamond symbol is used for decision-making conditions.
Why are arrows important in flowcharts?
Arrows show the direction of flow from one step to another.
Interview Questions on Flowchart
Define flowchart.
A flowchart is a diagrammatic representation of an algorithm, workflow, or process that shows steps using symbols and arrows.
What is the purpose of a flowchart in programming?
The purpose of a flowchart is to visually represent program logic before writing actual code.
What is the difference between flowchart and pseudocode?
A flowchart represents logic visually using symbols and arrows, while pseudocode represents logic using English-like text.
Why is a decision symbol important?
A decision symbol is important because it shows conditional branching, such as Yes or No paths.
How does a flowchart help beginners?
A flowchart helps beginners understand program flow visually and makes logic easier to follow before coding.
Quick Summary
| Concept | Meaning |
|---|---|
| Flowchart | Visual representation of an algorithm or process. |
| Terminator | Shows Start or End. |
| Input / Output | Shows data input or output. |
| Process | Shows calculation or processing step. |
| Decision | Shows condition-based branching. |
| Flow Line | Shows direction of execution. |
| Connector | Connects different parts of a flowchart. |
Final Takeaway
A flowchart is an important visual planning tool in programming. It helps students understand algorithms, decisions, loops, and program flow before writing actual code. By using correct symbols and clear arrows, students can design better logic, reduce mistakes, and write programs with more confidence.