[go: up one dir, main page]

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

More Problems On Nested Loops 1st Feb

Uploaded by

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

More Problems On Nested Loops 1st Feb

Uploaded by

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

More problems on Nested Loops

Answer the following questions:


1. A loop within another loop is called…………

2. You can use --------- statement to terminate a loop block.

3. …………statement will repeat a loop for next iteration after ignoring


some statements of the loop.

Give the output:

int i,j;
for (i=0; i<4; i++)
{
for (j=i; j>=0; j--)
System.out.print(j);
System.out.println();
}

Give the output:


int y,p;
for (int x=1; x<=3; x++)
{
for (y=1; y<=2; y++)
{
p = x * y;
System.out.print(p);
}
System.out.println( );
}

Give the output:


public class Pattern
{
public static void main()
{
for (int i = 1; i <= 5; i++)
{
for (int j = i; j >= 1; j--)
{
System.out.print(j + " ");
}
System.out.println(); }}}
12345
2345
345
45
5

99999
77777
55555
33333
11111

97531
9753
975
97
9

2
24
246
2468
2 4 6 10

*
* #
* # *
* # * #
* # * # *

You might also like