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.
Flowcharts use a set of standard symbols, each with a specific meaning. Knowing these symbols is essential to read and create flowcharts correctly.
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 --> GTo create effective flowcharts, follow these important rules:
Flowcharts become powerful when they can represent decisions and repetitive actions (loops). Let's understand how these are shown.
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 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.
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])
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 --> KStep 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])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 --> GStep 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])
When to use: When beginning to draw any flowchart to maintain clarity.
When to use: When representing conditional logic to avoid confusion.
When to use: Throughout the flowchart design process.
When to use: When the flowchart becomes too large or complicated.
When to use: When creating real-life problem examples.
Progress tracking is paywalled — subscribe to mark subtopics as understood and save your streak.
Go to practice →