What is an Algorithm?
An algorithm is a step-by-step procedure or set of rules designed to
solve a specific problem or perform a task. It takes an input,
processes it, and produces an output.
1. Characteristics of an Algorithm
a. Well-defined Inputs – Takes zero or more inputs.
b. Definite Steps – Each step should be clear and
unambiguous.
c. Finite – The algorithm must terminate after a finite
number of steps.
d. Produces Output – It provides at least one result.
e. Efficient – It should use minimal resources (time & space).
2. Example: algorithm to calculate the average of two numbers
Step 1 : Start
Step 2 : Input number1, number2
Step 3 : sum = 0 ; average = 0
Step 4 : Calculate sum = (number1 + number2)
Step 5 : Average = sum / 2
Step 6 : Print average of two numbers
Step 7 : Stop
What is a Flowchart?
A flowchart is a graphical representation of an algorithm or process
using symbols to show the flow of execution step by step. It helps in
understanding, analyzing, and designing a process logically.
Why Use a Flowchart?
1. Helps in visualizing the logic of a program
2. Easy to understand for beginners and developers
3. Makes debugging & modification of a process easier.
4. Useful for problem-solving & process planning
5. Example: flowchart to calculate the average of two numbers.