Simvik

Area of a rectangle

Combine two parameters into one result. An easy embedded C problem (First steps in C), run and graded in the browser.

easy · First steps in C · arithmetic · parameters

A display driver needs to know how many pixels a rectangle covers.

Return the area of a rectangle that is width wide and height high.

Starter code

int area(int width, int height) {
  return 0;
}

Example tests

Three by four

printf("%d\n", area(3, 4));

Expected output:

12

A thin rectangle

printf("%d\n", area(10, 1));

Expected output:

10

Learn it first

More First steps in C problems