Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

What is the output from the following C++ code fragment? int count = 10; while(c

ID: 3627521 • Letter: W

Question

What is the output from the following C++ code fragment?

int count = 10;
while(count-- > 0)
{
cout << count << " ";
}
cout << endl;

What is the output from the following C++ code fragment?

int count = 1;
do
{
cout << count * (count - 1) << " ";
}while(++count <=5);
cout << endl;

What is the output from the following C++ code fragment if the following values are the inputs to cin?

58 23 75 176 145 -999

int num;
cin >> num;
while(num != -999)
{
cout << num % 25 << " ";
cin >> num;
}
cout << endl;

Explanation / Answer

What is the output from the following C++ code fragment?

int count = 10;
while(count-- > 0)
{
cout << count << " ";
}
cout << endl;


9 8 7 6 5 4 3 2 1 0 /// value of count after each iteration

What is the output from the following C++ code fragment?

int count = 1;
do
{
cout << count * (count - 1) << " ";
}while(++count <=5);
cout << endl;

0 2 6 12 20 // multiplication of count and next count.

What is the output from the following C++ code fragment if the following values are the inputs to cin?

58 23 75 176 145 -999

int num;
cin >> num;
while(num != -999)
{
cout << num % 25 << " ";
cin >> num;
}
cout << endl;

8 23 0 1 20    // it is just remainder of every number that is entered.

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote