Algorithms and Flowcharts for Classes 5 to 8: Symbols and Examples

Computer Science study notes for Classes 5 to 8, with examples, practice questions and answers.

In short: An algorithm is a step-by-step set of clear instructions written in plain words to solve a problem or complete a given task. A flowchart is a diagram that uses standard geometric boxes and directional arrows to display those exact steps visually.

Every computer game, mobile app, and classroom maths problem relies on a logical plan before any code is typed. In computer studies for middle school, learning how to design an algorithm and turn it into a neat diagram helps students think clearly, spot mistakes early, and break big challenges into manageable steps. This guide covers core definitions, standard symbols, worked examples, and revision questions tailored for Class 5 to Class 8 learners across CBSE, ICSE, and international curricula.

What is an algorithm in computer science?

An algorithm is an ordered sequence of clear, unambiguous instructions designed to accomplish a specific goal. Computers cannot think for themselves: they follow orders strictly in the order they receive them. If an instruction is missing, vague, or placed in the wrong position, the computer produces an unexpected result or stops working altogether.

An everyday recipe for baking a cake or a printed set of instructions for assembling a toy bicycle is a real-life algorithm. In computer studies, however, instructions must follow strict qualities to be useful:

  • Clear and unambiguous: Each instruction must have only one possible interpretation.
  • Well-defined inputs: You must know exactly what values or items you are starting with.
  • Well-defined outputs: The expected result must be clear once the steps finish.
  • Finiteness: The steps must eventually come to an end rather than running forever.
  • Feasibility: Every step must be practical and possible to carry out using available tools.

Understanding flowcharts and visual problem solving

A flowchart is a diagrammatic representation of an algorithm. Instead of reading lines of text, you follow shapes connected by arrows from a starting point to an endpoint. This graphical view makes the order of actions easy to understand at a glance.

When software engineers or school students plan solutions, drawing a flowchart helps them verify whether their logic flows in the right direction. It also reveals whether any decisions, such as checking whether a test score is above passing level, have been handled correctly without leaving loose ends.

Standard flowchart symbols and their meanings

To ensure that everyone can read a diagram without confusion, computer scientists use standard flowchart symbols. Each shape has a dedicated role in representing actions, inputs, outputs, and choices.

Symbol shape Standard name Purpose in a flowchart Example instruction or label
Oval (or rounded rectangle) Terminator Indicates where the flowchart begins and ends. Every chart has one Start and at least one Stop. Start, Stop
Parallelogram Input / Output box Used whenever data is gathered from the user or information is printed on the screen. Read Length, Print Total Marks
Rectangle Process box Represents calculations, data manipulation, or physical actions. Sum = A + B, Set Counter = 1
Diamond (rhombus) Decision box Asks a question with two possible answers, usually Yes or No (True or False), creating separate paths. Is Marks >= 40?, Is Number > 0?
Arrow line Flowline Shows the exact direction of logic flow from one symbol to the next. Connects Process to Output (or labelled "Yes" / "No")
Small circle Connector Connects two or more flowlines on the same page to keep the diagram tidy and avoid criss-crossing lines. Label such as "A" or "1" connecting matching points

Key differences between an algorithm and flowchart

Both tools describe the exact same problem-solving logic, but they present that logic differently. The table below outlines how an algorithm and flowchart differ in classroom assignments and real programming workflows.

Feature Algorithm Flowchart
Format Numbered, step-by-step written text in simple language. Visual diagram using standardised geometric shapes.
Creation method Quick to write down using a pen or keyboard. Drawn with a ruler, template, or diagramming tool.
Branching visibility Conditions are written as "If-Then-Else" statements, which can become lengthy. Branching paths split into visible arrows (Yes/No), making choices obvious.
Error checking Requires reading line by line to trace the logic. Broken paths, missing arrows, and dead ends can be spotted immediately.
Standard rules Begins with Step 1 and ends with a clear final step. Strictly uses standard shapes such as ovals, parallelograms, and diamonds.

Step-by-step algorithm examples for everyday tasks

Examining simple algorithm examples from everyday routines helps students understand how computers process sequential tasks before moving to numbers and formulas.

Example 1: Preparing a cup of warm drinking chocolate.

Algorithm:

  1. Step 1: Start.
  2. Step 2: Take a clean mug and add one teaspoon of cocoa powder.
  3. Step 3: Add one teaspoon of sugar to the mug.
  4. Step 4: Heat one cup of milk in a saucepan until warm.
  5. Step 5: Pour the warm milk into the mug.
  6. Step 6: Stir the mixture thoroughly with a spoon until dissolved.
  7. Step 7: Serve the warm chocolate drink.
  8. Step 8: Stop.

Flowchart structure: Start inside an oval, connect six sequential process rectangles using downward arrows, and finish with a Stop oval. Because there are no decisions or repetitions, the flowline moves straight from top to bottom.

Example 2: Adding two numbers and finding their average.

Algorithm:

  1. Step 1: Start.
  2. Step 2: Read two numbers, A and B.
  3. Step 3: Calculate the sum: Sum = A + B.
  4. Step 4: Calculate the average: Average = Sum / 2.
  5. Step 5: Display the value of Average.
  6. Step 6: Stop.

Flowchart structure:

  • Start (Oval).
  • Input A, B (Parallelogram).
  • Sum = A + B (Rectangle).
  • Average = Sum / 2 (Rectangle).
  • Display Average (Parallelogram).
  • Stop (Oval).

Worked check: Let A = 16 and B = 24. First, Sum = 16 + 24 = 40. Next, Average = 40 / 2 = 20. The displayed result is 20.

Mathematical and logical algorithm examples with flowcharts

As students advance through Class 6, Class 7, and Class 8, problem solving involves conditional checks (decisions) and repeated steps (loops). The examples below demonstrate these structures step by step.

Example 3: Checking whether a student has passed an examination.

A student passes if their marks are 40 or higher out of 100.

Algorithm:

  1. Step 1: Start.
  2. Step 2: Read the student marks (M).
  3. Step 3: Check whether M is greater than or equal to 40.
  4. Step 4: If M >= 40 is True, display "Passed".
  5. Step 5: If M >= 40 is False, display "Needs Improvement".
  6. Step 6: Stop.

Flowchart structure: An oval for Start leads into a parallelogram for inputting M. Next comes a diamond containing the condition "Is M >= 40?". One arrow labelled "Yes" leads to an output box showing "Passed". A second arrow labelled "No" leads to an output box showing "Needs Improvement". Both output boxes then connect down to a single Stop oval.

Worked check: If M = 65, the condition 65 >= 40 is True, so the result is "Passed". If M = 32, the condition 32 >= 40 is False, so the result is "Needs Improvement".

Example 4: Finding the greater of two unequal numbers.

Algorithm:

  1. Step 1: Start.
  2. Step 2: Read two distinct numbers, X and Y.
  3. Step 3: Check whether X is greater than Y.
  4. Step 4: If X > Y is True, display "X is greater".
  5. Step 5: If X > Y is False, display "Y is greater".
  6. Step 6: Stop.

Flowchart structure: An oval for Start leads into a parallelogram for reading X and Y. A diamond box tests "Is X > Y?". The "Yes" branch directs to a parallelogram printing "X is greater", while the "No" branch directs to a parallelogram printing "Y is greater". Both paths join at the final Stop oval.

Worked check: Let X = 45 and Y = 72. The test 45 > 72 is False. The flowchart follows the "No" branch and outputs "Y is greater" (72).

Example 5: Calculating the area and perimeter of a rectangle.

Algorithm:

  1. Step 1: Start.
  2. Step 2: Read the length (L) and breadth (B) in centimetres.
  3. Step 3: Calculate the area: Area = L * B.
  4. Step 4: Calculate the perimeter: Perimeter = 2 * (L + B).
  5. Step 5: Display Area and Perimeter.
  6. Step 6: Stop.

Flowchart structure: Start (Oval) points to Input L, B (Parallelogram). This flows into two process rectangles: Area = L * B, followed by Perimeter = 2 * (L + B). An output parallelogram prints both values, leading to Stop.

Worked check: Suppose a rectangle has Length = 12 cm and Breadth = 7 cm. Area = 12 * 7 = 84 square cm. Perimeter = 2 * (12 + 7) = 2 * 19 = 38 cm. Both formulas produce precise values.

Example 6: Printing numbers from 1 to 5 using a loop (repetition).

In computer programming, repeating a set of instructions until a condition changes is called a loop.

Algorithm:

  1. Step 1: Start.
  2. Step 2: Set Count = 1.
  3. Step 3: Display the value of Count.
  4. Step 4: Add 1 to Count (Count = Count + 1).
  5. Step 5: Check whether Count <= 5.
  6. Step 6: If True, go back to Step 3.
  7. Step 7: If False, proceed to Step 8.
  8. Step 8: Stop.

Flowchart structure: An oval for Start leads into a process rectangle setting Count = 1. An output box displays Count, followed by a process box adding 1 to Count. Next, a diamond asks "Is Count <= 5?". The "Yes" arrow loops back up to the output box. The "No" arrow points straight down to a Stop oval.

Trace table:

  • Round 1: Count = 1, Prints 1, Count becomes 2. 2 <= 5 is True (loop continues).
  • Round 2: Count = 2, Prints 2, Count becomes 3. 3 <= 5 is True (loop continues).
  • Round 3: Count = 3, Prints 3, Count becomes 4. 4 <= 5 is True (loop continues).
  • Round 4: Count = 4, Prints 4, Count becomes 5. 5 <= 5 is True (loop continues).
  • Round 5: Count = 5, Prints 5, Count becomes 6. 6 <= 5 is False (loop ends).

Best practices for writing clear algorithms

Writing an effective algorithm requires discipline and clean structure. Students can keep their solutions neat and easy to grade by following these standard conventions:

  • Number every line: Always begin with Step 1, Step 2, and continue in sequence. This makes referencing instructions during testing simple.
  • Start and finish explicitly: The first instruction must always be "Start", and the final instruction must always be "Stop".
  • Keep instructions atomic: Write only one action per step. Do not combine reading values, calculating a formula, and printing results into a single sentence.
  • Use standard action words: Stick to keywords such as "Read" or "Input" for data collection, "Calculate" or "Set" for operations, and "Display" or "Print" for outcomes.
  • Remain language-independent: Write in clear English rather than specific programming syntax like Python, C++, or Java. The algorithm should be understandable to anyone regardless of which software tool they use.

Common mistakes

Middle school students frequently lose marks on simple diagramming errors. Reviewing the five common errors below ensures full marks in school practicals and theory papers.

Mistake Correct method Why it matters
Omitting Start or Stop terminators. Always begin with an oval labelled Start and finish with an oval labelled Stop. Without clear boundaries, a programmer or computer cannot tell where execution begins or when to shut down.
Using a rectangle to take user input or display output. Use a parallelogram for reading inputs and displaying outputs; reserve rectangles solely for processes and calculations. Examiners check shape conventions strictly. A rectangle indicates internal work, not interaction with the user.
Leaving exit arrows unlabelled on a decision diamond. Clearly write "Yes" and "No" (or "True" and "False") beside the outgoing arrows of every diamond. If branches are not labelled, anyone following the flowchart cannot determine which path corresponds to which outcome.
Creating an infinite loop by forgetting to update the counter. Ensure that every loop includes a step modifying the counter variable so the exit condition is eventually met. If the counter never changes, the condition remains True permanently and the program hangs in an endless loop.
Crossing flowlines haphazardly across the page. Use a small circle connector symbol or rearrange symbols so arrows do not intersect. Crossing lines confuse the reader and make tracing the sequence difficult during examination grading.

Practice questions

  1. Which flowchart symbol is used to accept a student roll number from the keyboard?
    Answer

    A parallelogram (Input / Output box) is used because entering a roll number is a data input action.

  2. Write an algorithm to check whether an integer is positive or negative (assume the number is not zero).
    Answer

    Step 1: Start. Step 2: Read number N. Step 3: Check if N > 0. Step 4: If True, display "N is positive". Step 5: If False, display "N is negative". Step 6: Stop.

  3. A flowchart has: Set K = 2. Display K. K = K + 2. Is K > 8? If No, loop back to Display K. If Yes, Stop. What values are displayed?
    Answer

    The values displayed are 2, 4, 6, and 8. When K reaches 10, the condition 10 > 8 becomes True, so the flowchart stops without printing 10.

  4. How many outgoing arrows must a decision diamond have, and what do they represent?
    Answer

    A decision diamond must have exactly two outgoing arrows. One represents the path when the condition evaluates to Yes (True), and the other represents the path when it evaluates to No (False).

  5. Write an algorithm to calculate the total price of 7 notebooks if one notebook costs 15 rupees.
    Answer

    Step 1: Start. Step 2: Set Quantity = 7. Step 3: Set UnitPrice = 15. Step 4: Calculate TotalCost = Quantity * UnitPrice (7 * 15 = 105 rupees). Step 5: Display TotalCost. Step 6: Stop.

  6. Identify the error in this sequence: Step 1: Input A, B. Step 2: Sum = A + B. Step 3: Print Sum.
    Answer

    The sequence is missing both the mandatory "Start" instruction at the beginning and the "Stop" instruction at the end.

  7. Which symbol should be used to test whether a person is at least 18 years old to vote?
    Answer

    A diamond (Decision box) containing the condition "Is Age >= 18?".

  8. What is the difference between a process box and an input/output box? Give one example of each.
    Answer

    An input/output box (parallelogram) exchanges data with the user, such as "Read Mark". A process box (rectangle) performs internal operations or calculations, such as "Total = Mark1 + Mark2".

  9. Write an algorithm to convert a temperature of 20 degrees Celsius into Fahrenheit using the formula F = (C * 9 / 5) + 32. Show the final calculated number.
    Answer

    Step 1: Start. Step 2: Set C = 20. Step 3: Calculate F = (20 * 9 / 5) + 32 = (180 / 5) + 32 = 36 + 32 = 68. Step 4: Display F as 68 degrees Fahrenheit. Step 5: Stop.

  10. What is an infinite loop, and how can a student prevent it in a flowchart?
    Answer

    An infinite loop is an endless cycle where instructions repeat continuously because the exit condition is never satisfied. It can be prevented by ensuring that a process box inside the loop updates the counter or decision variable on every pass.

Frequently asked questions

Why must we write an algorithm before creating a computer program?
Writing an algorithm first allows students to plan their logic and resolve mistakes using simple words before dealing with computer syntax, spelling errors, or punctuation rules in a programming language.
Can a problem have more than one correct algorithm?
Yes. Different people can design different logical steps to reach the exact same correct result. Some methods may require fewer steps or less memory, but both can be valid solutions.
Can a flowchart have more than one Stop symbol?
While it is best practice to funnel all branch paths into a single Stop oval, having multiple Stop ovals is acceptable in complex diagrams where connecting lines would clutter the page.
What should I do if my flowchart does not fit on a single page?
Use an off-page connector symbol (shaped like a small pentagon pointing downwards) labelled with a letter such as "A". Place a matching connector at the top of the next page to show where the flow resumes.
What is the difference between an algorithm and pseudocode?
An algorithm is written in plain, descriptive language for human understanding. Pseudocode looks closer to real programming code, using structured keywords like IF, ELSE, WHILE, and PRINT without following any single language syntax strictly.
Are flowlines allowed to point upwards in a flowchart?
Yes, but upward-pointing flowlines should be used almost exclusively when creating loops to return to an earlier step. Normal sequential execution should always travel from top to bottom or left to right.

Related topics

Written by the Reportcards mentor team. Updated 26 November 2026.

Personal academic mentorship

Personal computer science mentorship in small batches

In Adarsh Nagar, Jaipur, and live online, KG to Class 12 students learn in batches of about six with one mentor. Founder Dr. Vishruti Arora brings 20+ years of mentoring across CBSE, ICSE/ISC, Cambridge IGCSE and IB.

WhatsApp +91 97835 96795. We reply within one working day.

MentorshipKG to Class 12

  • Small batches of about six with one mentor
  • 704, Frontier Colony, Jaipur, or live online
  • Classes Monday to Saturday, 3pm to 10pm