Resources | Subject Notes | Computer Science
To document a simple algorithm for calculating the area of a rectangle using structured English, a flowchart, and pseudo-code.
The following describes the algorithm in structured English:
The following is the pseudo-code representation of the algorithm:
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. |