Chapter 4 – Algorithms and Flowcharts
Class 8 – ICSE Computer Applications
🔷 Summary (Short Version)
What is an Algorithm?
- An algorithm is a step-by-step method to solve a problem or complete a task.
- It is written in simple English and helps a computer programmer know what to do and
how to do it.
Features of a Good Algorithm:
1. Clear and precise steps.
2. Definite start and end.
3. Takes input and gives output.
4. Steps should be in a logical order.
Example: Algorithm to Add Two Numbers:
1. Start
2. Input first number → A
3. Input second number → B
4. Add A and B → C
5. Display C
6. Stop
What is a Flowchart?
- A flowchart is a visual diagram that shows the steps of an algorithm.
- It uses symbols and arrows to represent actions and flow of control.
Common Flowchart Symbols:
- Terminal (Oval): Start or End
- Input/Output (Parallelogram): Enter or Display data
- Process (Rectangle): Action or calculation
- Decision (Diamond): Yes/No or True/False condition
- Arrow (Line): Shows the direction of flow
Example: Flowchart to Add Two Numbers:
- Start (Oval)
- Input A, B (Parallelogram)
- C = A + B (Rectangle)
- Display C (Parallelogram)
- End (Oval)
Importance of Algorithms and Flowcharts:
1. Helps in planning before coding.
2. Reduces mistakes in the program.
3. Makes debugging and testing easier.
4. Improves communication and understanding.
Difference between Algorithm and Flowchart:
| Feature | Algorithm | Flowchart |
|---------|-----------|-----------|
| Form | Written steps | Diagram with symbols |
| Language | English-like | Graphical |
| Easy to Write | Yes | Slightly harder |
| Easy to Understand | Sometimes | Yes, visually |
📘 Detailed Explanation
What is an Algorithm?
An algorithm is a finite set of instructions written in a step-by-step manner to solve a
particular problem.
Key Points:
- Written in simple language (usually English).
- Steps are numbered and ordered logically.
- It must always give the correct result if the steps are followed properly.
- Used in programming to plan what the program will do.
Properties of a Good Algorithm:
1. Finiteness – It must end after a certain number of steps.
2. Definiteness – Each step must be clear and not confusing.
3. Input – It should accept input values.
4. Output – It should produce results.
5. Effectiveness – All steps must be simple enough to be done easily.
Example Algorithms:
Algorithm to Add Two Numbers:
1. Start
2. Read number A
3. Read number B
4. Add A and B → store in C
5. Display C
6. Stop
Algorithm to Check Even or Odd:
1. Start
2. Read a number (N)
3. Divide N by 2
4. If remainder is 0, then it's Even
5. Else, it is Odd
6. Stop
What is a Flowchart?
A flowchart is a diagrammatic representation of an algorithm. It shows each step using
symbols and arrows to indicate the flow of control.
Standard Flowchart Symbols:
- Terminator (Oval): Start or Stop
- Input/Output (Parallelogram): Read or Display data
- Process (Rectangle): Action, calculation, or process
- Decision (Diamond): Yes/No or True/False decisions
- Arrow (Line): Shows flow of control
Example Flowchart Descriptions:
Flowchart to Add Two Numbers:
1. Start (Oval)
2. Input A and B (Parallelogram)
3. Add A + B = C (Rectangle)
4. Output C (Parallelogram)
5. Stop (Oval)
Flowchart to Check Even or Odd:
1. Start
2. Input N
3. N % 2 == 0? (Diamond)
- Yes → Print "Even"
- No → Print "Odd"
4. Stop
Uses of Algorithms and Flowcharts:
- Helps break down big problems into smaller steps
- Allows programmers to plan before writing code
- Easy to test each step for errors
- Helps explain the working of a program to others
Difference Between Algorithm and Flowchart:
| Feature | Algorithm | Flowchart |
|--------|-----------|-----------|
| Form | Text-based | Visual diagram |
| Ease of Writing | Easier | Takes more time |
| Understanding | Medium | Easier to understand visually |
| Used By | Beginners and experts | Mostly for beginners or planning |
Practice Questions:
1. Write an algorithm to find the greater of two numbers.
2. Draw a flowchart to find the average of three numbers.
3. What is the difference between algorithm and flowchart?
4. What are the advantages of using a flowchart?
Conclusion:
- An algorithm is a list of steps to solve a problem.
- A flowchart is a diagram that shows those steps clearly.
- Both are essential tools for planning programs and problem-solving in computer science.