Computer Programming I -- A Complete Guide to Algorithms and Flowcharts
INTRODUCTION
Every app on your phone — from WhatsApp to PalmPay — started as a simple set of instructions written by a programmer. Before a single line of code is typed, a programmer must first think clearly: what exactly needs to happen, and in what order? That thinking process is what programming is really about, and it begins long before a computer is even switched on.
In Nigeria today, technology is changing everything. The way we pay for goods, how farmers get weather information, how students in Kebbi or Borno access lessons online — all of it depends on software. And behind every piece of software are programmers who learned, right from secondary school, how to break problems into logical steps.
That is exactly what this lesson is about. As an SSS2 student, you are at the point where programming starts to make real sense. In this lesson, you will learn how to think like a programmer using two foundational tools: algorithms and flowcharts. These are the building blocks of every computer program ever written, from the simplest calculator app to the most advanced banking software.
LEARNING OBJECTIVES (NERDC-Aligned)
By the end of this lesson, students should be able to:
- Define the terms algorithm and flowchart accurately
- Identify and describe the standard symbols used in drawing flowcharts
- Write a clear step-by-step algorithm to solve a given problem
- Draw a flowchart to represent a given algorithm
- Distinguish between sequential, selection, and repetition control structures
- Apply algorithmic thinking to solve simple real-life and academic problems
MAIN CONTENT
What Is Computer Programming?
Computer programming is the process of writing a set of instructions that tells a computer what to do. These instructions must be written in a way the computer can understand and execute. Computers are very powerful machines, but they are not intelligent on their own. They only do exactly what they are told, step by step. If you give them wrong instructions, they will produce wrong results — programmers call this "garbage in, garbage out."
Programming is used to create websites, mobile apps, banking software, games, hospital management systems, and almost every digital tool in use today. Learning to program starts with learning to think logically, and that is where algorithms and flowcharts come in.
What Is an Algorithm?
An algorithm is a finite, ordered, and well-defined set of steps or instructions written to solve a particular problem or accomplish a specific task. The word "algorithm" comes from the name of a 9th-century Persian mathematician named Muhammad ibn Musa al-Khwarizmi, whose work on step-by-step calculation methods influenced modern computing.
Before a programmer writes any code, they first write out the algorithm. It is the plan. The code comes later. Think of an algorithm the way an architect thinks of a building plan before the builders arrive on site.
Properties of a Good Algorithm
A good algorithm must have the following qualities:
- It must be clear and unambiguous. Every step should have only one meaning.
- It must be finite. It must come to an end and not run forever.
- It must have defined input and output. It should accept some data and produce a useful result.
- It must be effective. Every step must be simple enough to be carried out without confusion.
- It must be general enough to solve not just one specific instance but the broader class of the problems
Real-Life Nigerian Example 1: Buying Airtime at a Shop
Step 1: Start Step 2: Walk to the nearest airtime seller Step 3: State the network you want — MTN, Glo, Airtel, or 9mobile Step 4: State the amount you want to buy Step 5: Hand over the correct money Step 6: Collect the recharge PIN or scratch card Step 7: Dial the recharge code on your phone Step 8: Wait for the confirmation SMS Step 9: Stop
That is a complete algorithm. It has a clear start, ordered steps, and a definite end.
Real-Life Nigerian Example 2: Finding the Larger of Two Numbers
Step 1: Start Step 2: Read the first number, call it A Step 3: Read the second number, call it B Step 4: If A is greater than B, display "A is the larger number" Step 5: Otherwise, display "B is the larger number" Step 6: Stop
This is an algorithm that a computer program can follow to compare two values and give a result.
Real-Life Nigerian Example 3: Algorithm for Paying with USSD Code
Step 1: Start Step 2: Open your phone dialer Step 3: Dial the USSD code for your bank (e.g., *737# for GTBank) Step 4: Select the transfer option from the menu Step 5: Enter the recipient's account number Step 6: Enter the amount to transfer Step 7: Enter your PIN when prompted Step 8: Confirm the transaction Step 9: Receive confirmation message Step 10: Stop
What Is a Flowchart?
A flowchart is a pictorial or diagrammatic representation of an algorithm. Instead of writing out steps in plain language, a flowchart uses standard shapes connected by arrows to show the flow of logic from one step to the next. Flowcharts make it very easy to visualize the structure of a program before writing the actual code.
Think of a flowchart as a road map. Instead of writing directions in words, you draw the route with roads and arrows. The flowchart does the same for a program — it shows you the path the program will take, including any decisions it needs to make along the way.
Standard Flowchart Symbols and Their Meanings
The following are the symbols you must know for your SSS2 exams and beyond:
-
Oval (Terminator): Used to mark the Start or End of a flowchart. Every flowchart must begin and end with this symbol.
-
Rectangle (Process Box): Represents any action, operation, or calculation. For example, "Add A and B" or "Multiply price by quantity."
-
Diamond (Decision Box): Represents a question or condition that has two possible answers — Yes or No, True or False. The flowchart branches in two directions from this point.
-
Parallelogram (Input/Output): Used to show when data is being received (input) or when a result is being displayed (output). For example, "Read student score" or "Print total."
-
Arrow (Flow Line): Shows the direction of flow from one step to the next. Arrows connect all the symbols in the correct order.
-
Circle (Connector): Used when a flowchart is too large to fit on one page. It connects one part of the flowchart to another part on a different section or page.
Types of Control Structures in Algorithms
Every algorithm, no matter how complex, is built from just three basic control structures:
1. Sequence Structure
This is the simplest structure. Steps are carried out one after another in a straight line. There is no branching or repetition — the program just moves from top to bottom. Example: cooking a pot of soup — you do each step in order without skipping or repeating.
2. Selection Structure (Decision / Branching)
This structure allows the algorithm to make a choice. Based on a condition, the program takes one path or another. This is represented in a flowchart using the diamond symbol.
Example in everyday life: If you have enough money for transport, take a bus. If not, walk.
In algorithm form: Step 1: Start Step 2: Check if transport money is available Step 3: If YES, board a bus Step 4: If NO, walk to the destination Step 5: Stop
3. Repetition Structure (Loop)
This structure allows certain steps to be repeated over and over until a condition is met. It is useful when the same operation needs to happen multiple times.
Example: Counting the number of students in a class, one by one, until you have counted all of them.
Worked Example: Flowchart for Calculating a Student's Average Score
Let us say a student wrote three subjects in a test and we want to find the average. Here is how we write the algorithm and describe the flowchart:
Algorithm: Step 1: Start Step 2: Input score for Subject 1 (call it S1) Step 3: Input score for Subject 2 (call it S2) Step 4: Input score for Subject 3 (call it S3) Step 5: Calculate Average = (S1 + S2 + S3) divided by 3 Step 6: Display Average Step 7: Stop
Flowchart Description (shapes in order):
- Oval: Start
- Parallelogram: Input S1, S2, S3
- Rectangle: Average = (S1 + S2 + S3) / 3
- Parallelogram: Display Average
- Oval: End
PRACTICAL APPLICATIONS IN NIGERIA
Algorithms and flowcharts are not just classroom theory. They are used every day in Nigeria and around the world.
-
Banking and Fintech: Every time you transfer money on Opay, Kuda, or Flutterwave, an algorithm is working in the background to verify your account, check your balance, deduct the amount, credit the recipient, and send you a confirmation — all in seconds.
-
Market and Inventory Systems: Shops in Onitsha Main Market that have gone digital use inventory software built on simple algorithms that check stock levels, alert managers when items are running low, and calculate the total cost of goods.
-
E-Learning Platforms: Platforms like Edves and SchoolForce, used by Nigerian schools, use algorithms to calculate student results, generate report cards, and track attendance automatically.
-
Agriculture: In states like Kano and Kaduna, agricultural extension apps use algorithmic decision trees to help farmers identify crop diseases, decide when to plant, and estimate harvest yield.
-
Traffic Management: Although still developing in Nigeria, smart traffic systems work on flowchart-based logic — if traffic on Road A is heavy, divert vehicles to Road B.
ADVANTAGES AND DISADVANTAGES OF USING ALGORITHMS AND FLOWCHARTS
Advantages:
- They make it easy to plan a program before writing any code, saving time and reducing errors.
- Flowcharts give a clear visual picture of the logic, making it easy for anyone to understand, even non-programmers.
- They help identify errors in logic before the program is built.
- They make it easier to explain a program to another programmer or to a client.
- Algorithms can be reused and adapted for similar problems.
Disadvantages:
- Drawing flowcharts for very large or complex programs can be time-consuming and difficult to manage.
- Flowcharts can become too large and confusing when the program logic is highly complex.
- Algorithms written in plain language may be interpreted differently by different people, leading to inconsistency.
- Updating a flowchart every time a change is made to the program can be frustrating.
ETHICAL AND SAFETY CONSIDERATIONS
As you begin your journey into computer programming, it is important to think not only about how to write instructions, but about the responsibility that comes with it.
-
Write honest programs. A programmer who deliberately writes code to deceive users — for example, an app that secretly collects your contacts or drains your data — is acting unethically. In Nigeria, this is also increasingly becoming a legal issue under the Cybercrimes Act.
-
Respect privacy. When writing algorithms that handle people's information — such as names, scores, or bank details — treat that data with care. Do not design systems that expose private information unnecessarily.
-
Think about consequences. Every algorithm produces an outcome. Before building a program, think carefully about what happens if the user enters wrong data, or if the program is misused.
-
Avoid plagiarism in code. Copying another person's code and presenting it as yours without acknowledgment is the same as plagiarism in writing. Always give credit where it is due, especially when using open-source resources.
CLASSROOM AND HOME ACTIVITIES
Activity 1: Algorithm Writing Exercise
Write a step-by-step algorithm for the following task: A student wants to determine whether they passed or failed a test. They pass if their score is 50 or above. Write the algorithm for this.
Activity 2: Flowchart Drawing Exercise
Using the algorithm you wrote in Activity 1, draw a complete flowchart using the correct symbols. Label each symbol clearly.
Activity 3: Group Discussion
In groups of four, discuss at least three everyday activities in your school or community that follow a clear algorithmic pattern. Present your findings to the class, explaining each step.
Activity 4: Home Exercise
Write an algorithm for how you get ready for school in the morning. Begin from when your alarm rings and end when you arrive at the school gate. Identify at least one decision point and one repeated action in your algorithm.
ASSESSMENT QUESTIONS
Section A: Objective Questions
-
Which of the following best describes an algorithm? a) A computer language used to write programs b) A diagram that shows how a computer works internally c) An ordered set of steps for solving a specific problem d) A hardware component used in programming
-
Which flowchart symbol is used to represent a decision or condition? a) Rectangle b) Oval c) Diamond d) Parallelogram
-
What symbol is used to mark the Start and End of a flowchart? a) Rectangle b) Diamond c) Parallelogram d) Oval
-
A flowchart that repeats a set of steps until a condition is met is said to use which control structure? a) Sequence b) Selection c) Repetition d) Declaration
-
Which of the following is NOT a property of a good algorithm? a) It must be finite b) It must be ambiguous c) It must produce an output d) It must be clear
Section B: Theory Questions
-
Define the term "algorithm" and state four properties that a good algorithm must have.
-
Explain the three types of control structures found in algorithms. Give one real-life Nigerian example for each.
-
With the aid of a clearly labelled flowchart, show how a program would determine whether a student's score qualifies them for a distinction (75 and above), a credit (50–74), or a fail (below 50).
SUMMARY
In this lesson, we covered the following key points:
- Computer programming is the process of giving precise instructions to a computer to perform a task.
- An algorithm is a finite, ordered, and well-defined set of steps used to solve a problem.
- A good algorithm must be clear, finite, have defined input and output, and be effective.
- A flowchart is a visual representation of an algorithm using standard symbols such as ovals, rectangles, diamonds, parallelograms, and arrows.
- The three main control structures in algorithms are sequence (steps in order), selection (decision-making), and repetition (looping).
- Algorithms and flowcharts are used in banking, agriculture, education, healthcare, and many other sectors in Nigeria and globally.
CONCLUSION
Learning to write algorithms and draw flowcharts is not just a topic to pass in your SSS2 exams. It is the very foundation of how every software application in the world is built. Whether you want to become a software developer, a data analyst, an entrepreneur building the next Nigerian fintech startup, or simply someone who understands how the digital world works, this knowledge is indispensable.
Nigeria needs more young people who can think logically, solve problems methodically, and communicate clearly with technology. That journey begins right here, in your SSS2 Computer Science class, with a blank sheet of paper and the ability to write clear, step-by-step instructions. Master this, and the world of programming opens up to you.
FREQUENTLY ASKED QUESTIONS (FAQ)
Q1: What is the difference between an algorithm and a program? An algorithm is the logical plan or set of steps for solving a problem, written in plain language or pseudocode. A program is the actual code written in a computer language (like Python or JavaScript) that implements that algorithm. The algorithm always comes first.
Q2: Can a flowchart be drawn without writing the algorithm first? It is always better to write the algorithm first. The algorithm helps you think through the logic, and the flowchart then gives that logic a visual form. Jumping straight to the flowchart without planning can lead to errors and confusion.
Q3: What software can Nigerian students use to draw flowcharts? Students can use free tools like draw.io (also called diagrams.net), Microsoft Visio (if available in school), or even Google Slides and PowerPoint to create basic flowcharts. For exam purposes, however, you are expected to draw them accurately by hand.
Q4: Is algorithm writing tested in WAEC and NECO? Yes. Both WAEC and NECO regularly test students on writing algorithms, drawing flowcharts, and identifying control structures. It is a major and recurring topic in the Computer Studies/Data Processing paper.
Q5: How long should a typical algorithm be? There is no fixed length. An algorithm should be as long as the problem requires — no more, no less. What matters is that every necessary step is included, the steps are in the right order, and the algorithm arrives at a clear conclusion.
Q6: What is pseudocode and how is it related to algorithms? Pseudocode is a way of writing an algorithm using a mix of plain English and simple programming-style language. It is more structured than plain English but not tied to any specific programming language. It is commonly used by programmers as an intermediate step between the plain-language algorithm and the actual code.



0 Comments