Home » C++ Programming » Loop Types » Question
  1. What is the output of this program?
    #include 
    using namespace std;
    int main()
    {
    int num = 20;
    for ( ; ;)
    cout << num;
    return 0;
    }
    1. 20
    2. Compilation Error
    3. Runtime Error
    4. infinite times of printing num
    5. None of these
Correct Option: D

There is not a condition in the for loop, So it will loop continuously.



Your comments will be displayed only after manual approval.