A
Q. What is the output of the following C++ code?
Code:
#include <iostream>
using namespace std;
void Sum(int a, int b, int & c)
{
a = b + c;
b = a + c;
c = a + b;
}
int main()
{
int a = 2, b =1;
Sum(a, b, b);
cout << a << " " << b;
return 0;
}
using namespace std;
void Sum(int a, int b, int & c)
{
a = b + c;
b = a + c;
c = a + b;
}
int main()
{
int a = 2, b =1;
Sum(a, b, b);
cout << a << " " << b;
return 0;
}
- Correct Answer - Option(C)
- Views: 37
- Filed under category C++
- Hashtags:
Discusssion
Login to discuss.