What is the difference between a pretest loop and a posttest loop? (2, 4, 5)
How many times will each of the following loops execute? What is the output in each case? (5)
a. x = 5; y = 50;
do
x = x + 10;
while (x <>
cout < x=””>< “=”” “=””>< y=””>< endl;=””>
b. x = 5;
y = 80;
do
x = x * 2;
while (x <>
cout < x=””>< “=”” “=””>< y=””>< endl;=””>
c. x = 5;
y = 20;
do
x = x + 2;
while (x >= y);
cout < x=””>< “=”” “=””>< y=””>< endl;=””>
d. x = 5;
y = 35;
while (x <>
x = x + 10;
cout < x=””>< “=”” “=””>< y=””>< endl;=””>
e. x = 5;
y = 30;
while (x <=>
x = x * 2;
cout < x=””>< “=”” “=””>< y=””>< endl;=””>
f. x = 5;
y = 30;
while (x > y)
x = x + 2;
cout < x=””>< “=”” “=””>< y=””><>