Free tutorials & notes in Hindi & English · Clean code examples 🧰 Free PDF & Image Tools →
🧩 Unit 2 – Problem Solving  ·  Lesson 10

Flowchart, Pseudocode & Decomposition

Ways to represent an algorithm

We can write an algorithm in plain steps (as in the previous lesson), but two standard forms are clearer: a flowchart (a picture) and pseudocode (structured English).

Flowchart

  • Diagram with standard shapes and arrows
  • Easy to see the flow at a glance
  • Good for small algorithms
  • Hard to change for big programs

Pseudocode

  • Text with keywords like IF, WHILE, PRINT
  • Close to real code
  • Easy to modify
  • No standard picture
Two ways to show the same algorithm

Flowchart symbols

SymbolNameUsed for
⬭ Oval (rounded)TerminatorStart / Stop
▱ ParallelogramInput / OutputRead input, print output
▭ RectangleProcessCalculation or assignment, e.g. sum = a + b
◇ DiamondDecisionYes/No question, two exits
→ ArrowFlow lineShows the order of steps
○ Small circleConnectorJoins parts of a long flowchart

Flowchart: sequence

Steps run one after another, top to bottom. Example: find the simple interest SI = P × R × T ÷ 100.

StartInput P, R, TSI = P × R × T / 100Print SIStop
Sequence – simple interest

Flowchart: selection (if-else)

A diamond chooses one of two paths. Example: print "Pass" if marks ≥ 33, otherwise "Fail".

StartInput marksmarks >= 33 ?YesNoPrint "Fail"Print "Pass"Stop
Selection – pass or fail

Flowchart: repetition (loop)

An arrow goes back to an earlier step so the steps repeat while a condition is true. Example: sum of numbers from 1 to N.

StartInput Ntotal = 0, i = 1i <= N ?YesNoPrint totaltotal = total + ii = i + 1Stop
Repetition – the loop goes back to the decision
Python
n = int(input('Enter N: '))
total = 0
i = 1
while i <= n:
    total = total + i
    i = i + 1
print('Sum =', total)
Enter N: 5 Sum = 15

Pseudocode

Pseudocode ("fake code") describes an algorithm using simple keywords in capital letters — INPUT, COMPUTE, PRINT, IF … THEN … ELSE, WHILE, FOR — with indentation to show blocks.

Pseudocode
INPUT marks
IF marks >= 90 THEN
    PRINT "Grade A"
ELSE IF marks >= 60 THEN
    PRINT "Grade B"
ELSE
    PRINT "Grade C"
END IF
Pseudocode
INPUT N
SET fact = 1
FOR i = 1 TO N
    fact = fact * i
END FOR
PRINT fact
💡 Tips

Write one action per line, indent the body of IF and loops, and do not worry about Python syntax like colons or brackets. Anyone should be able to read it.

Flow of control

The order in which steps run is the flow of control. Every algorithm is made from just three building blocks:

⬇️
SequenceSteps one after another. Example: input → calculate → print.
🔀
SelectionChoose a path based on a condition. Example: if age ≥ 18, can vote.
🔁
Repetition (iteration)Repeat steps while a condition holds. Example: print 1 to 10.
Three kinds of control flow

Decomposition

Decomposition means breaking a big problem into smaller parts. Each part is solved separately (often by a different team member) and the parts are then combined. A school result system can be decomposed like this:

📁 result-system/
├── read_marks          # input marks of each student
├── total_and_percent   # calculations
├── grade               # A1, A2, B1 ...
├── rank                # sort students
└── print_report_card   # output
Breaking a result system into sub-problems

In Python, each sub-problem becomes a function:

Python
# Decomposition: one big task split into small functions
def read_marks():
    return [78, 85, 92, 66, 81]          # sample marks

def total_of(marks):
    return sum(marks)

def grade_of(percent):
    if percent >= 90: return 'A1'
    if percent >= 80: return 'A2'
    if percent >= 70: return 'B1'
    return 'B2'

marks = read_marks()
t = total_of(marks)
p = t / len(marks)
print('Total:', t, '| Percent:', p, '| Grade:', grade_of(p))
Total: 402 | Percent: 80.4 | Grade: A2

Summary & practice

  • Flowchart symbols: oval (start/stop), parallelogram (I/O), rectangle (process), diamond (decision), arrows (flow).
  • Pseudocode uses keywords like INPUT, IF, WHILE, PRINT with indentation.
  • Flow of control: sequence, selection, repetition.
  • Decomposition splits a big problem into smaller ones.
✅ Practice

Draw a flowchart and write pseudocode to (1) print the multiplication table of a number, (2) find whether a number is positive, negative or zero.

Hint: (1) needs a loop from 1 to 10; (2) needs two decisions: N > 0, then N < 0.

Frequently Asked Questions

Which flowchart symbol is used for a decision?
A diamond. It contains a yes/no question such as "marks >= 33?" and has two exits labelled Yes and No.
What is the difference between pseudocode and a program?
Pseudocode is written in plain English-like statements and does not follow the strict rules of any language, so it cannot run. A program follows the exact syntax of a language like Python and can be executed.
What is decomposition?
Breaking a big, complex problem into smaller sub-problems that are easier to understand and solve separately, then joining their solutions.
← Class 11 Computer Science
🔗

Share this topic with a friend

यह topic किसी दोस्त को भेजें

Found it useful? Send it to a classmate learning the same thing.

अच्छा लगा? जो दोस्त यही सीख रहा है, उसे भेज दीजिए।

Next topicGetting Started with Python Your progress: 10 / 29 (34%) · Lesson 11 / 29 Continue →

How was this lesson?

Your feedback helps us make the content better.

Write a review or suggestion (optional)

After approval, your name and city may appear publicly with your review. Please do not write your email or phone number.

▶ CodingEasily on YouTube

Learn with video lessons in easy Hindi

Featured video: RDBMS Part 3 – Class XI Commerce IT

▶ Subscribe – it’s free