Ask Question
4 September, 07:00

What is the output of the following C+ + code?

#include

using namespace std;

void sum (int x, int y, int & z) { z = x + y; }

int main ()

{

int list1[3], list2[3];

int a = 5, b = 10, c = 0;

for (int i = 0; i < 3; i++)

{

list1[i] = i + 1;

list2[i] = i + 2;

}

//a sum (a, b, c);

cout << "c = " << c << endl;

//b sum (list1[0], list2[0], c);

cout << "c = " << c << endl;

//c sum (list1, list2, c);

cout << "c = " << c << endl;

//d for (int i = 1; i < 3; i++)

{

sum (list1[i], list2[i], c);

cout << "c = " << c << endl;

}

return 0;

}

+5
Answers (1)
  1. 4 September, 08:52
    0
    Your not including anything in your code.

    Explanation:

    According to your text all you have is #include. You didn't incldue any directives so you will get a error.
Know the Answer?
Not Sure About the Answer?
Get an answer to your question ✅ “What is the output of the following C+ + code? #include using namespace std; void sum (int x, int y, int & z) { z = x + y; } int main () { ...” in 📙 Computers & Technology if there is no answer or all answers are wrong, use a search bar and try to find the answer among similar questions.
Search for Other Answers