Home » C++ Programming » Operators » Question
  1. What is the output of this program?
    #include <iostream> 
    using namespace std;
    int main()
    {
    int num1 = 7;
    int num2 = 4;
    int num3 = 6;
    num1 = num2++;
    num2 = --num3;
    cout << num1 <<" " << num2 <<" " << num3;
    return 0;
    }
    1. 5 4 5
    2. 5 5 4
    3. 4 5 5
    4. Compilation Error
    5. None of these
Correct Option: C

In this program, We are pre increment and post incrementing the operands and saving it.



Your comments will be displayed only after manual approval.