What will the following code display Int number 6 unmber co
Solution
Please follow the code and data for description :
17)
int number = 6;
 number++;
 cout << number << endl;
In the above code the number variable has been assisted with a post increment operator which increments the value by 1 which means the result is 7 in this case.
So the answer is OPTION A (7).
18)
for(int i = 0; i <= 20; i++)
 cout << \"Hello\" << endl;
This is to be noted that the loop starts iterating from the value starting at 0 and that ends at 20 which means that the line next to the loop executes 21 times resulting in printing the data to console 21 times.
So the answer is OPTION C (21).
19)
for(int i = 0; i < 10; i++){
    for(int j = 0; j < 20; j++) {
        cout << \"Nice to Meet You.!\" << endl;
    }
 }
The above code runs the inner loop for 0 to 19 which is 20 times and the outer loop is iterated over the data for 0 to 9 resulting in 10 times iteration and that the console data is printed 200 times as for the every outer loop the inner loop iterates for 20 times that results in 10*20 = 200 times.
So the answer is OPTION D (200).
20)
int x = 0;
 for(int count = 0; count < 3; count++) {
    x += count;
 }
 cout << x << endl;
The code gets the data initialised with the value as 0 and now moving onto the loop that iterates from 0 to 2 for 3 times the data is added to the varaible that has been initialised earlier namely x with it previous value that it has been holding. So the loop goes to add the values 0, 1, 2 which is 3 as the result.
So the answer is OPTION B (3).
Hope this is helpful.

