0% found this document useful (0 votes)
22 views2 pages

For Loops Worksheet #1

Loops thing

Uploaded by

kartikeya.lathi
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOC, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
22 views2 pages

For Loops Worksheet #1

Loops thing

Uploaded by

kartikeya.lathi
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOC, PDF, TXT or read online on Scribd
You are on page 1/ 2

For Loops Worksheet #1

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 + " "); 1. -3 0 3 6 9 12 15 18
} _________________________________

for(int j=17; j>-2; j=j-2)


{
out.print(j + " ");
}
2. 17 15 13 11 9 7 5 3 1 -1
_________________________________

for(int x=20; x<50; x=x+3)


{
out.print(x + " ");
}
3. _________________________________

for(int m=37; m>0; m=m-4)


{
out.print(m + " ");
}

4. _________________________________

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

© A+ Computer Science – Worksheet – www.apluscompsci.com


5. _________________________________

© A+ Computer Science – Worksheet – www.apluscompsci.com

You might also like