Document a simple algorithm using a structured English description, a flowchart or pseudocode

Resources | Subject Notes | Computer Science

Algorithm: Calculating the Area of a Rectangle

Objective:

To document a simple algorithm for calculating the area of a rectangle using structured English, a flowchart, and pseudo-code.

1. Structured English

The following describes the algorithm in structured English:

  • START
  • INPUT the length of the rectangle (let this be l).
  • INPUT the width of the rectangle (let this be w).
  • CALCULATE the area of the rectangle using the formula: Area = l × w.
  • OUTPUT the calculated area.
  • END

2. Flowchart

Suggested diagram: A flowchart showing steps for inputting length and width, calculating area, and outputting the result.

3. Pseudo-code

The following is the pseudo-code representation of the algorithm:

  1. START
  2. INPUT l, w // Length and Width of the rectangle
  3. Area = l × w // Calculate the area
  4. OUTPUT Area // Display the calculated area
  5. END

4. Data Table

Step Description
1 Start the algorithm.
2 Prompt the user to enter the length of the rectangle.
3 Store the entered length in a variable (e.g., 'l').
4 Prompt the user to enter the width of the rectangle.
5 Store the entered width in a variable (e.g., 'w').
6 Calculate the area by multiplying 'l' and 'w'.
7 Store the calculated area in a variable (e.g., 'area').
8 Display the value of 'area' to the user.
9 End the algorithm.