Examples of Flowcharts /Algorithms
M3-R5.1 · Chapter 2: Algorithms and Flowcharts to Solve Problems · 2 min read
Example1 Here is the flowchart for going to the market to purchase a pen.
What is an Algorithm: An algorithm is a step-by-step procedure or set of rules to solve a specific problem. It is like a recipe that tells a computer (or person) exactly what to do in a structured manner.
Characteristics of a Good Algorithm
- Well-Defined Inputs & Outputs – Takes input and produces a clear output.
- Definiteness – Each step must be clear and unambiguous.
- Finiteness – Must complete in a finite number of steps.
- Effectiveness – Each step must be simple enough to be executed.
- Independence – Should be language-independent, meaning it can be implemented in any programming language.
Example: Algorithm for Exchanging Values of Two Variables
Step 1: Start
Step 2: Input two variables, say A and B
Step 3: Store the value of A in a temporary variable T
Step 4: Assign the value of B to A
Step 5: Assign the value of T (old value of A) to B
Step 6: Print the new values of A and B
Step 7: End