A
Q. What is the output of the following C++ code?
Code:
#include <iostream>
using namespace std;
int main()
{
int n = 5, i;
for (i = 0; i < n; i++)
{
n++;
cout << n << endl;
goto a;
}
a:
do
{
cout << "label a" << endl;
break;
}
while( 0 );
return 1;
}
using namespace std;
int main()
{
int n = 5, i;
for (i = 0; i < n; i++)
{
n++;
cout << n << endl;
goto a;
}
a:
do
{
cout << "label a" << endl;
break;
}
while( 0 );
return 1;
}
- Correct Answer - Option(D)
- Views: 24
- Filed under category C++
- Hashtags:
Discusssion
Login to discuss.