Worksheet 1 Loops
Worksheet 1 Loops
Note: The answers to this worksheet and further on worksheets to be written in a new
book of 200 Pages long size. Write Question + Answer
I. Do as directed:-
(1) Differentiate between Definite loop and indefinite loop.
(2) What do you mean by counter variable? Give an example.
(3) Write syntax for do while loop.
(4) Analyze how many the following loops gets executed and write the output:-
(a) int x=100;
while
(x>=10)
{
System.out.println (x);
x = x – 20;
}
(b) char
ch='a'; do
{
System.out.println (ch);
if(ch%4==0)
break;
ch++;
}while (ch<='z');
(5) Write a Java Program to display all the squares from 1 to 25
(6) Write a Java Program to display the series 0, 3, 8, 15, 24,............upto 15 terms.