An algorithm is a step-by-step procedure or a set of instructions for solving a problem or performing a task. Algorithms are the foundation of computer programming and are independent of specific programming languages.
Example of an Algorithm
Problem: Find the sum of two numbers.
Algorithm:
Start.
Input two numbers, say A and B.
Add A and B to get the sum, SUM = A + B.
Display the result SUM.
Stop.
In an algorithm, it is important to keep the following key elements in mind:
Terminals: Represent the start and end points.
Inputs: Identify the data required to process.
Process: Define the steps to solve the problem.
Output: Specify the result or solution.
A flowchart is a diagrammatic representation of an algorithm. It uses various symbols to represent different types of instructions or steps in a process, connected by arrows indicating the flow of the process.
Symbols Used in Flowchart
We use following symbols and shapes to create a flowchart:
Example of an Flowchart