Problem of the Day
Monday, November 9, 2026
Problem:
Consider the following method.
public static helper(int m, int n)
{
int c = 0;
while (m > n)
{
m -= n;
c += 1;
}
}
Which of the following operations does the method helper implement?
- calculating a power,
mn - integer division,
m / n - integer division,
m % n - integer multiplication,
m * n
The correct answer is b. The variable c counts how many times n can be subtracted from m, or (stated another way) how many times n can evenly "go into" m. This is integer division.