Last Updated :
10 Apr, 2024
Predict the output of the following program in C++
#include <iostream>
using namespace std;
int main ()
{
int a, b;
a = 10;
b = 4;
a = b;
b = 7;
cout << \"a:\";
cout << a;
cout << \" b:\";
cout << b;
return 0;
}
(A) a:4 b:7
(B) a:10 b:4
(C) a:4 b:10
(D) None of the mentioned
Answer: (A)
Explanation: In this program, we are reassigning the values of a and b because of this we got the output as a:4 b:7
Share your thoughts in the comments
Please Login to comment...