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

Revision of Class 9 Loops

The document provides instructions for a revision assignment on loops in Java. It asks students to: 1) State the differences between break/continue keywords and for/do-while loops. 2) Analyze the output of three code snippets using loops. 3) Write two Java programs, one to print letters with prime ASCII values and another to print a numeric pattern using nested loops.

Uploaded by

Manju Yadav
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)
98 views

Revision of Class 9 Loops

The document provides instructions for a revision assignment on loops in Java. It asks students to: 1) State the differences between break/continue keywords and for/do-while loops. 2) Analyze the output of three code snippets using loops. 3) Write two Java programs, one to print letters with prime ASCII values and another to print a numeric pattern using nested loops.

Uploaded by

Manju Yadav
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

Revision of Class 9

Loops
Assignment 1
------------------------------------------------------------------------------
General Instructions:-
1. The following assignments (unless otherwise mentioned) are meant to be done
in your school notebook.
2. Please use a giant ruled notebook (non-interleafed) as your computer
applications c.w. / h.w. notebook.
3. This assignment is to be submitted in the first computer class once the school
reopens.
----------------------------------------------------------------------------------------------------
1) State two differences between:
a. break and continue keywords.
b. for and do while loops.
2) State the output of the following snippets:
a. int i,j;
for (i=1;i<=5;++i)
{for(j=1;j<=3;j+=2)
System.out.print(++i*j--);
System.out.println();
}
b. int i,j,s=0;
for (i=1;i<=5;i+=2)
{for(j=3;j>=i;j--);
s+=j-i;
}
System.out.print(s);
c. int k=23;
while((k=k-3)>k/2)
{if(k==12)
continue
else if (k==5)
break;
System.out.println(k--);
}
System.out.println(++k);
3) Write the following programs in Java.
a. Design a program to print all the upper case English letters with prime
ASCII values.
b. Design a program to print the following pattern using nested loops.
1#
2@3#
4@5#6@
7#8@9#10@

You might also like