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;
}
  • (A) 5 label a
  • (B) 5
  • (C) label a
  • (D) 6 label a
πŸ’¬ Discuss
βœ… Correct Answer: (D) 6 label a

You must be Logged in to update hint/solution

πŸ’¬ Discussion


πŸ“Š Question Analytics

πŸ‘οΈ
196
Total Visits
πŸ“½οΈ
4 y ago
Published
πŸŽ–οΈ
Ram Sharma
Publisher
πŸ“ˆ
88%
Success Rate