Tracing
How many times does the third line execute in each of the following loops? Assume m, n, and product are declared as int. Your answers may be expressed in terms of m and n.
a. for (int i = 1; i < = n; i++)
for (int j = 1 ; j < = m; j + +)
product = i * j;
b. for (int i = 1; i < = 8; i++)
for (int j = 1 ; j < = i; j++)
product = i * j;
c. for (int i = 1; i < = m; i++)
for (int j = 1 ; j < = i; j++)
product = i * j;
d. int max = 1;
for (int i = 1; i < = n; max *= 2, i + +);
for (int i = max; i > = 1; i = i / 2)
System.out.println(i);
We need at least 10 more requests to produce the solution.
0 / 10 have requested this problem solution
The more requests, the faster the answer.