?

Free Version

Upgrade subject to access all content

Difficult

Arithmetic Operations: Modulo vs Integer Division

APCSA-VXYKFE

Consider the following methods.

public static void drawGrid(int x)
{
    for (int i = 0; i < x; i++)
        drawCircle(30 + (i%6)*20, 30 + (i/6)*20);
}

public static void drawCircle(int x, int y)
{
    /*draws a circle at position (x,y)*/
}

Calling drawGrid(20) will result in a grid of circles containing

A

one row of 6 circles.

B

three rows of 6 circles and another row of 2 circles.

C

four rows of 4 circles and another row of 3 circles.

D

four rows of 5 circles.

E

five rows of 4 circles.