Please login to post your comments.
Name two jump statements and their uses.
What will be the output of the following code?
int m = 2;
int n = 15:
for(int i = 1; i < 5; i++)
m++; --n;
System.out.println("m=" + m):
System.out.println("n=" + n);Analyze the following program segment and determine how many times the loop will be executed and what will be the output of the program segment.
int k = 1, i = 2;
while (++i < 6)
k *= i;
System.out.println(k);State the difference between entry controlled loop and exit controlled loop.
Analyse the following program segment and detemine how many times the loop will be executed and what will be the output of the program segment?
int p = 200;
while (true)
{
if (p < 100)
break;
p = p - 20;
}
System.out.println(p);Rewrite the following program segment using while instead of for statement.
int f = 1, i;
for(i = 1; i <= 5; i ++)
{
f *= i;
}
System.out.println(f);