👁 Preview — Study, Practice and Revise are open; mock tests and the rest of the syllabus unlock on subscription. Unlock all · ₹4,999
← Back to Programming Fundamentals
Study mode

Flowcharts

Introduction to Flowcharts

When we write a computer program, we need a clear plan to tell the computer what steps to follow. This plan is called an algorithm, which is a step-by-step procedure to solve a problem. However, sometimes reading or writing algorithms in plain text can be confusing. This is where flowcharts come in handy.

A flowchart is a visual diagram that uses symbols and arrows to represent the flow of steps in an algorithm or process. Think of it as a map that guides you through the journey of solving a problem, showing each decision, action, and input/output clearly.

Flowcharts help programmers and learners by making complex processes easier to understand, communicate, and debug. They are especially useful in the early stages of programming to design and plan before writing actual code.

Basic Flowchart Symbols

Flowcharts use a set of standard symbols, each with a specific meaning. Knowing these symbols is essential to read and create flowcharts correctly.

  • Terminator (Start/End): Represented by an oval shape, this symbol marks the beginning and end of a flowchart.
  • Input/Output: Shaped like a parallelogram, this symbol shows where data is entered (input) or displayed (output).
  • Process: A rectangle that represents a step where some operation or calculation is performed.
  • Decision: A diamond shape used to represent a point where a decision is made, leading to different paths based on conditions (e.g., Yes/No).

These symbols connect with arrows that show the direction of flow, guiding you from one step to the next.

graph TD    A([Start]) --> B[/Input Number/]    B --> C[Process: Multiply by 2]    C --> D{Is result > 10?}    D -- Yes --> E[/Output "Greater than 10"/]    D -- No --> F[/Output "10 or less"/]    E --> G([End])    F --> G

Flowchart Construction Rules

To create effective flowcharts, follow these important rules:

  • Flow Direction: The flow should move consistently from top to bottom or left to right. This helps readers follow the process naturally.
  • Use Arrows: Arrows must clearly indicate the direction of flow between symbols. Avoid missing arrows as they cause confusion.
  • Avoid Crossing Lines: Try not to let arrows cross each other. If unavoidable, use connectors (small labeled circles) to keep the flow neat.
  • Single Entry and Exit: Each symbol should have one entry point and one exit point (except decision symbols which have two or more exits).
  • Clarity and Simplicity: Keep the flowchart simple and easy to read. Break complex processes into smaller flowcharts if needed.

Representing Decisions and Loops

Flowcharts become powerful when they can represent decisions and repetitive actions (loops). Let's understand how these are shown.

Decisions

A decision symbol (diamond) asks a question that can be answered with "Yes" or "No" (or "True"/"False"). Based on the answer, the flow branches into different paths.

Loops

Loops allow repeating a set of steps until a condition is met. In flowcharts, loops are created by connecting the flow back to a previous step using arrows, usually controlled by a decision symbol.

graph TD    A([Start]) --> B[/Input Number/]    B --> C{Is Number > 0?}    C -- Yes --> D[Process: Print Number]    D --> E[Process: Decrement Number by 1]    E --> C    C -- No --> F([End])

In this example, the flow loops back to check the condition repeatedly until the number is no longer greater than zero.

Worked Example 1: Calculate the Average of Two Numbers

Example 1: Calculate the Average of Two Numbers Easy
Create a flowchart to input two numbers, calculate their average, and display the result.

Step 1: Start the flowchart with the Start symbol.

Step 2: Use an input symbol to enter the first number (say, num1).

Step 3: Use another input symbol to enter the second number (num2).

Step 4: Use a process symbol to calculate the average: average = (num1 + num2) / 2.

Step 5: Use an output symbol to display the average.

Step 6: End the flowchart with the End symbol.

graph TD    A([Start]) --> B[/Input num1/]    B --> C[/Input num2/]    C --> D[Process: average = (num1 + num2) / 2]    D --> E[/Output average/]    E --> F([End])

Worked Example 2: Find the Largest of Three Numbers

Example 2: Find the Largest of Three Numbers Medium
Design a flowchart to input three numbers and determine the largest among them.

Step 1: Start and input three numbers: a, b, and c.

Step 2: Use a decision symbol to check if a > b.

Step 3: If yes, check if a > c. If yes, a is largest.

Step 4: If a > c is no, then c is largest.

Step 5: If a > b is no, check if b > c. If yes, b is largest.

Step 6: Otherwise, c is largest.

Step 7: Output the largest number and end.

graph TD    A([Start]) --> B[/Input a/]    B --> C[/Input b/]    C --> D[/Input c/]    D --> E{Is a > b?}    E -- Yes --> F{Is a > c?}    F -- Yes --> G[/Output a is largest/]    F -- No --> H[/Output c is largest/]    E -- No --> I{Is b > c?}    I -- Yes --> J[/Output b is largest/]    I -- No --> H    G --> K([End])    H --> K    J --> K

Worked Example 3: Calculate Factorial of a Number Using Loop

Example 3: Calculate Factorial of a Number Using Loop Medium
Create a flowchart to calculate the factorial of a positive integer using a loop.

Step 1: Start and input the number n.

Step 2: Initialize two variables: fact = 1 and counter = n.

Step 3: Use a decision symbol to check if counter > 0.

Step 4: If yes, multiply fact = fact x counter, then decrement counter = counter - 1.

Step 5: Loop back to the decision step.

Step 6: If counter is zero, output fact and end.

graph TD    A([Start]) --> B[/Input n/]    B --> C[Process: fact = 1, counter = n]    C --> D{Is counter > 0?}    D -- Yes --> E[Process: fact = fact * counter]    E --> F[Process: counter = counter - 1]    F --> D    D -- No --> G[/Output fact/]    G --> H([End])

Worked Example 4: Check if a Number is Prime

Example 4: Check if a Number is Prime Hard
Design a flowchart to check whether a given number is prime by testing divisibility.

Step 1: Start and input the number n.

Step 2: If n ≤ 1, output "Not prime" and end.

Step 3: Initialize i = 2.

Step 4: Check if i ≤ √n. If no, output "Prime" and end.

Step 5: If yes, check if n mod i = 0. If yes, output "Not prime" and end.

Step 6: If no, increment i = i + 1 and repeat step 4.

graph TD    A([Start]) --> B[/Input n/]    B --> C{Is n ≤ 1?}    C -- Yes --> D[/Output "Not Prime"/]    D --> E([End])    C -- No --> F[Process: i = 2]    F --> G{Is i ≤ sqrt(n)?}    G -- No --> H[/Output "Prime"/]    H --> E    G -- Yes --> I{Is n mod i = 0?}    I -- Yes --> D    I -- No --> J[Process: i = i + 1]    J --> G

Worked Example 5: Calculate Simple Interest

Example 5: Calculate Simple Interest Easy
Create a flowchart to calculate simple interest given principal (P in INR), rate (R in %), and time (T in years).

Step 1: Start and input principal P, rate R, and time T.

Step 2: Use the formula SI = (P x R x T) / 100 in a process symbol.

Step 3: Output the calculated simple interest SI.

Step 4: End the flowchart.

graph TD    A([Start]) --> B[/Input P, R, T/]    B --> C[Process: SI = (P * R * T) / 100]    C --> D[/Output SI/]    D --> E([End])

Formula Bank

Simple Interest
\[ SI = \frac{P \times R \times T}{100} \]
where: P = Principal amount (INR), R = Rate of interest (% per annum), T = Time (years)

Tips & Tricks

Tip: Always start with a clear Start symbol and end with an End symbol to define the flow boundaries.

When to use: When beginning to draw any flowchart to maintain clarity.

Tip: Use decision symbols sparingly and clearly label the branches (Yes/No or True/False).

When to use: When representing conditional logic to avoid confusion.

Tip: Keep the flow direction consistent (top to bottom or left to right) to improve readability.

When to use: Throughout the flowchart design process.

Tip: Break complex processes into smaller sub-processes or multiple flowcharts.

When to use: When the flowchart becomes too large or complicated.

Tip: Use metric units and INR currency in examples to relate to the Indian context without losing general applicability.

When to use: When creating real-life problem examples.

Common Mistakes to Avoid

❌ Using incorrect or inconsistent flowchart symbols.
✓ Use standard symbols consistently as per flowchart conventions.
Why: Students may confuse symbols leading to ambiguous or incorrect flowcharts.
❌ Crossing flow lines or arrows causing confusion.
✓ Arrange flowchart elements to avoid crossing lines; use connectors if necessary.
Why: Poor layout reduces readability and understanding.
❌ Omitting start or end symbols.
✓ Always include clear start and end points in the flowchart.
Why: Defines the scope and flow boundaries of the process.
❌ Not labeling decision branches clearly.
✓ Label all decision outcomes (e.g., Yes/No) to clarify flow direction.
Why: Unlabeled branches cause ambiguity in logic.
❌ Representing loops incorrectly or missing loop-back arrows.
✓ Use decision symbols and arrows correctly to show looping behavior.
Why: Loops are essential for iterative processes; incorrect representation leads to logical errors.
Key Concept

Key Flowchart Symbols

Understanding the standard symbols is essential to create and interpret flowcharts accurately.

✨ AI exam tools — try them free (included in every plan)
Tip: select any text above to Explain / Example / Simplify it.
Curated videos per subtopic
Top YouTube explainers, AI-ranked for your exam and language. Unlocks with subscription.
Unlock

Try Practice next.

Progress tracking is paywalled — subscribe to mark subtopics as understood and save your streak.

Go to practice →
Ask a doubt
Flowcharts · 10 free messages
Ask me anything about this subtopic. You have 10 free messages this session — chat history isn't saved in preview.