Lab 7
count = 1;
y = 100;
while (count < 100)
{
y = y –1;
count++;
}
cout<< “ y= “<<y << “ and count = “ <<count << endl;
a)
x =5; y = 50;
do
x = x +10;
while (x < y);
cout << x << “ “ << y << endl;
b)
x =5; y = 80;
do
x = x * 2;
while (x < y);
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 < y)
x=x + 10;
cout << x << “ “ << y << endl;
e)
x =5; y = 30;
while (x <= y)
x=x + 2;
cout << x << “ “ << y << endl;
f)
x =5; y = 30;
while (x > y)
x=x + 2;
cout << x << “ “ << y << endl;
aaaaa
aaaa
aaa
aa
a
.
and only if t is divisible by 11. For example, suppose that n = 8784204. Then t = 4-0 +2 – 4 + 8 – 7 + 8 = 11. Because 11 is divisible by 11, it follows that 8784204 is divisible by 11.If n = 54063297, then
7 – 9 +2 – 3 + 6 – 0 + 4 – 5 = 2. Because 2 is not divisible by 11, 54063297 ids not divisible by 11. Write a program that prompts the user to enter a positive integer and then uses this criterion to determine whether the number is divisible by 11. If the user enters a negative number the program should print out “you have entered a negative number and then prompt the user again for a positive number to check..