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.
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.