Question: Trace the for loops below in the table to the right. If the loop is an infinite loop, trace three iterations and write infinite loop.
Trace the for loops below in the table to the right. If the loop is an infinite loop, trace three iterations and write infinite loop.
a) int sum = 0;
sum count for (int count = 3; count >= 17; count = count + 4)
{
sum = sum + count:
}
b) sum index int sum = 0;
for (int index = 1; index < 5; ++index)
{
sum = sum + (1 /index);
c)
int product = 2;
for (int count = 0; product > 0; ++count)
{
product = product * product;
}
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
