1. Engineering
  2. Computer Science
  3. count the number of iterations in the following loops please...

Question: count the number of iterations in the following loops please...

Question details

Count the number of iterations in the following loops. please explain with steps, how we counted the no. of iterations in these loops step by step.

(a)
int count = 0;
while (count < n) {
  count++;
}

(b)
for (int count = 0;
  count <= n; count++) {
}

(c)
int count = 5;
while (count < n) {
  count++;
}

(d)
int count = 5;
while (count < n) {
  count = count + 3;
}
Solution by an expert tutor
Blurred Solution
This question has been solved
Subscribe to see this solution