Question: C++ 1. Write a for statement to add all the multiples of 3 between 1 and 100. 2.How many times will each of the following
C++
1. Write a for statement to add all the multiples of 3 between 1 and 100.
2.How many times will each of the following loops execute? What is the output in each case?
a.
x=5;y=50; do
x = x + 10;
while (x < y);
cout << x << " " << y << endl;
x = 5; y = 80;
do
x = x * 2;
while (x < y);
cout << x << " " << y << endl;
b.
x = 5; y = 20; do
x = x + 2;
while (x >= y);
cout << x << " " << y << endl;
c.
x = 5; y = 35; while (x < y)
x = x + 10;
cout << x << " " << y << endl;
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
