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

In this program, we are reassigning the values of num1 and num2 because of this we got the output as num1:5 num2:3



Your comments will be displayed only after manual approval.