Class X Nested Loops
Class X Nested Loops
COMPUTER WORSHEET
TOPIC: NESTED LOOPING
Q1: Select the correct option for the following.
a) int y,p;
for (int x=10; x<=30; x++)
{for (y=15; y<=20; y++)
{p = x * y;
System.out.print(p);}
System.out.println( );}
b)int w=6;
for (int x=2; x<=6; x++)
{for (int y=1; y<=5; y++)
{if (w%y==0)
break;
System.out.print(y);}
w=w*2;
System.out.println(w);}
97531
9753
975
97
9
The code is
for(int i=1;_________;i=i+2)
{
for (_____;j>=i;_____)
System.out.print(j);
}
System.out.print();
***********************************************************************************