Nested for loops
for (i = 1; i < 5; i++)
{
for (j = 1; j < 3; j++)
{
if (j % 2 == 0)
{
printf (“O”);
}
else
{
printf (“X”);
}
}
printf (“\n”);
}
How many times is the ‘if’ statement executed?
What is the output ??
Previous slide
Next slide
Back to first slide
View graphic version