Flowcharts for Algorithms

Jul 26, 2025

Overview

This lecture introduces flowcharts as visual tools for representing algorithms using standardized symbols, covers their main components, and provides step-by-step examples for basic programming problems.

Introduction to Flowcharts

  • A flowchart visually represents the sequence, decisions, and processes in algorithms using standard symbols.
  • Flowcharts are helpful in planning and designing programs before actual coding.

Flowchart Symbols and Their Functions

  • Terminator (Ellipse): Indicates the start and end of a flowchart.
  • Preparation (Parallelogram or Rectangle): Used to declare or assign values to variables or constants.
  • Input/Output (Parallelogram): Represents data input from or output to the user.
  • Decision (Diamond): Used for branching (if-else conditions).
  • Process (Rectangle): Indicates operations such as assignments or calculations.
  • Flow lines (Arrows): Show the direction of flow from one step to another.
  • Connector (Circle): Connects flowcharts across separate pages or areas.

Example 1: Display "Hello World"

  • Start with a terminator labeled "Start."
  • Use an output symbol to display "Hello World."
  • End with a terminator labeled "End."

Example 2: Display Name and Age

  • Start, then output name and age on separate lines.
  • Alternatively, use preparation to declare variables for name and age, and output each variable.
  • Demonstrates the use of string and integer variables.

Example 3: Check for Minor or Legal Age

  • Start, prompt for user's age as input.
  • Use a decision symbol to check if age ≤ 17.
  • Output "You are a minor" if true; else output "Legal."
  • Finish with terminator.

Example 4: Sum of Two Numbers

  • Start the flowchart.
  • Input first and second numbers from user.
  • Use a process symbol to calculate their sum: sum = first + second number.
  • Output the value of sum.
  • End the flowchart.

Key Terms & Definitions

  • Flowchart — A diagram that depicts the sequence of operations in a process or program.
  • Terminator — Symbol used to indicate the start and end points of a flowchart.
  • Preparation — Step where variables or constants are initialized or assigned.
  • Input/Output — Steps where data is received from or displayed to the user.
  • Decision — Symbol representing branching logic (e.g., if-else).
  • Process — Step showing operations like calculations or assignments.
  • Connector — Used to join flow lines across different pages.

Action Items / Next Steps

  • Practice drawing flowcharts for common programming problems using the symbols discussed.
  • Prepare questions or clarifications for the next live online discussion.
  • Export flowchart examples as PNG images for submission if required.