Home » C++ Programming » Data Types » Question
  1. What is the output of this program?
    #include 
    using namespace std;
    int main()
    {
    int p = 15;
    if (p < 13) {
    for (k = 0; k < 12; k++)
    cout << k;
    }
    else {
    cout << k;
    }
    return 0;
    }
    1. Compilation Error
    2. Runtime Error
    3. Garbage Value
    4. All of above
    5. None of these
Correct Option: A

In function 'int main()':
7:18: error: 'k' was not declared in this scope
11:21: error: 'k' was not declared in this scope



Your comments will be displayed only after manual approval.