For Loops Worksheet

By Mickey Arnold
Last updated 10 months ago
5 Questions
DIRECTIONS : Fill in each blank with the correct answer/output. Assume each statement happens in order and that one statement may affect the next statement. Some sections might print more than once.

for(int i=-3; i<19; i=i+3)
{
out.print(i + " ");
}

for(int j=17; j>-2; j=j-2)
{
out.print(j + " ");
}

for(int x=20; x<50; x=x+3)
{
out.print(x + " ");
}

for(int m=37; m>0; m=m-4)
{
out.print(m + " ");
}

int total=0;
for(int s=1; s<19; s++)
{
total=total+s;
}
out.println(total);