Question

In: Computer Science

Fill in the blanks of the following segment of code, so that the output would be 1 3 4.

Fill in the blanks of the following segment of code, so that the output would be 1 3 4.

int count = 0;

do

{

++ count;

if (count == 2)

Blank;

cout << count << " ";

} while (count <= Blank);

cout << endl;

Solutions

Expert Solution

We need to skip 2 in output so we can use continue for that purpose. And to print upto 4 we can use ( while <= 3) condition.

C++ code :-

#include

using namespace std;

int main()

{

int count=0;

do{

++count;

if(count==2)

continue;

cout<

}while(count<=3);

cout<

}

Output :-

1 3 4


Related Solutions

The following code fragment is expressed in arm assembly code. Fill in the blanks, so that...
The following code fragment is expressed in arm assembly code. Fill in the blanks, so that it is equivalent to the following C code. int counter; int x = 5; int y = 6; for (counter =10; counter >0;counter--) IF(X==Y) Y = Y + 1 ; ELSE Y = Y + 2} Fill in the blanks in the following code: MOV__________ ;loop counter into r0-ten times round the loop MOV__________ ;Value of y loaded into r1 MOV__________ ;Value of x...
Fill in the blanks in the MATLAB code below.
Fill in the blanks in the MATLAB code below. (Do not type unnecessary words or blank spaces in your response. The correct answers are case-sensitive.) % Consider a row vector v. % Complete the lines of code below to find the average and standard deviation of the elements of vector v such that these two values are assigned to variables M and S, respectively. E = G =
Fill in the blanks with suitable code and identify the type of inheritance in the following...
Fill in the blanks with suitable code and identify the type of inheritance in the following code snippet.(CO5) [Write all the three constructors completely in the answer sheet. Don’t write any other parts of the program] class Xyz { int one, two; public: Xyz(--------) {one=i; --------; } }; class Abc { int dc; public: Abc(int k) {-----------;} }; class Ijk: public Abc, public Xyz { int f; public: Ijk(int l, int m, int z, int n):-------,--------- { f=n;} }; int...
Fill in the blanks: Consider the following equilibrium and fill in the blanks with either increase...
Fill in the blanks: Consider the following equilibrium and fill in the blanks with either increase or decrease. I2(s) + 5F2(g) ⇌ 2IF5(g) A decrease in volume results in a Blank 1 in pressure which will Blank 2 the amount of IF5.
Fill in the blanks in the following table. At which level of output do we obtain...
Fill in the blanks in the following table. At which level of output do we obtain maximum profit? What is the relationship between marginal revenue and marginal cost at the profit-maximizing level of output? Level of Output Total Revenue Total Cost Profit Marginal Revenue Marginal Cost Marginal Profit 20 2400 1900 420 100 21 2800 120 22 3180 140 23 3540 160 24 3880 180 25 4200 200 26 4500 220 27 4780            240 28 5040 260 29 5280 280...
4. For each of the following sentences, fill in the blanks with the best word or...
4. For each of the following sentences, fill in the blanks with the best word or phrase selected from the list below. Not all words or phrases will be used; use each word or phrase only once. Microtubules are formed from the tubulin heterodimer, which is composed of the nucleotide-binding __________________ protein and the __________________ protein. Tubulin dimers are stacked together into protofilaments; __________________ parallel protofilaments form the tubelike structure of a microtubule. __________________ rings are important for microtubule nucleation...
21. What is the output of the following segment of code if 7 is input by...
21. What is the output of the following segment of code if 7 is input by the user when asked to enter a number?____________ int num; int total = 0; cout << "Enter a number from 1 to 10: "; cin >> num; switch (num) { case 1: case 2: total = 5; case 3: total = 10; case 7: total = total + 3; case 8: total = total + 6; default: total = total + 4; } cout...
Fill in the blanks of this code to print out the numbers 1 through 7. number...
Fill in the blanks of this code to print out the numbers 1 through 7. number = 1 while number ___ 7:     print(number, end=" ")     ___
Fill in the blanks on the following table
 Fill in the blanks on the following tableE&pshareholder basisdistributiondividendreturn of capitalcapital gain20,000300,00080,000120,00010,000170,000220,000100,000170,00020,000080,000<20,000>50,000170,000
Fill-In-The-Blanks 13. Complete the code by filling in the blanks for each question below. (Length of...
Fill-In-The-Blanks 13. Complete the code by filling in the blanks for each question below. (Length of blank doesn’t matter.) a) Print out the contents of the array airlines. #include #include ________________ using namespace std; int main () { string airlines[] = {"american","pan-am","southwest"}; for (int i = 0;_______________;i++) cout << ____________ << endl; return 0; } b) Read in 5 integers from the user and write them back out in reverse order int numbers[5]; for(int i = 0; ___________; _________) cin...
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT