In this example, we design an algorithm to find the perimeter and area of a rectangle.
To find the perimeter and area of a rectangle, you need to know the rectangle’s length and width. The perimeter and area of the rectangle are then given by the following formulas:
perimeter = 2 · (length + width)
area = length · width