Skip to content

2. Rectangle Areas

In this problem, you’re asked to enter some APL code, including an APL symbol and the data (text or numbers) given to it. Your code will be tested by the APL Challenge system to check whether it gives the correct answer and uses the methods described below.

In APL, multiplication uses the symbol × (Times). It works as you’d expect. However, in APL all basic mathematical symbols can work on multiple numbers at once. For example, 5 2 3 × 2 4 3 gives 10 8 9 because:

  1. 5 × 2 is 10
  2. 2 × 4 is 8
  3. 3 × 3 is 9

Write some APL code that uses a single × to calculate the area of three rectangles. The first has sides of length 3 and 2, the second has sides of length 1 and 7, and the third has sides of length 4 and 2. The result should be 6 7 8.