0% found this document useful (0 votes)
6 views

Nestedloops Worksheet1 Java Aplus

The document is a worksheet for A+ Computer Science focusing on nested loops. It contains multiple programming exercises where students need to fill in the expected output of nested loop structures. Each section requires understanding of loop behavior and output generation in Java.
Copyright
© © All Rights Reserved
Available Formats
Download as DOC, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
6 views

Nestedloops Worksheet1 Java Aplus

The document is a worksheet for A+ Computer Science focusing on nested loops. It contains multiple programming exercises where students need to fill in the expected output of nested loop structures. Each section requires understanding of loop behavior and output generation in Java.
Copyright
© © All Rights Reserved
Available Formats
Download as DOC, PDF, TXT or read online on Scribd
You are on page 1/ 1

A+ Computer Science – Nested Loop 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 a=1; a<=3; a++)


for(int b=2; b<5; b++)
out.print(a+b + " "); 1. _________________________________

for(int i=2; i<=6; i++){


for(int j=1; j<=i; j++)
out.print('*');
out.println(); 2. _________________________________
}

int total = 0;
for(int c=2; c<7; c++)
for(int d=1; d<=c; d++)
total = total + d; 3. _________________________________
out.println(total);

String s = "apluscs";
for(int e=0; e<s.length(); e++)
{
for(int f=0;f<=e;f++){
System.out.print(s.charAt(f));
}
System.out.println(); 4. _________________________________
}

int size=4;
for(int x=0; x<=size; x++ )
{
for(int y=x; y<=size; y++ )
out.print(" ");

for(int z=x; z>=0; z--)


out.print("A");
out.println(); 5. _________________________________
}

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

You might also like