Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

#include <iostream> using namespace std; int main() { int list1[5]; int list2[15

ID: 3831122 • Letter: #

Question

#include <iostream>

using namespace std;

int main()

{

       int list1[5];

       int list2[15];

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

              list1[i] = i * 1 - 2;

       cout << "list:";

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

              cout << list1[1] << " ";

       cout << endl;

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

       {

              list2[i] = list1[i] * i;

              list2[i + 5] = list1[4 - 1] + i;

              list2[i + 10] = list2[9 - 1] + list2[i];

       }

       cout << "list2: ";

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

              cout << list2[i] << " ";

       cout << end1;

       return 0;

}

Explanation / Answer

Answer

I dont know what you expect from this question

But this code will give you Compilation error in the lines

as these variables have not been declared in scope.

In line - cout << list1[1] << " ";, you are printing only the value of the array from the index position 1. If you provide -  cout << list1[i] << " ";, You can print all the values of tha array.

Try to submit the full code and also your expectation from this problem. Thank you :)