Question: Code comprehension (12 points). Determine whether the following code fragments are missing code valid code or if the ones given contain errors. Where there is
Code comprehension (12 points). Determine whether the following code fragments are missing code valid code or if the ones given contain errors. Where there is missing code, write it in, where there is an error, indicate the error and write the correction next to it. Where there is no error, write no error. There are supposed to be 22 lines of code including brackets. There are 11 lines of code with no errors
#include
int const arraySize 5;
int item[arraySize];
int sum;
cin << "Enter five numbers: ";
sum = 0;
for (int counter = 0; counter <= 5; counter++)
{
cin >> item[counter];
sum = sum + item[counter];
}
cout << endl;
cout << "The sum of the numbers is: " << item << endl;
cout << The numbers in reverse order are: ";
for (int counter = 4; counter >= 0; counter++)
cout << item[counter] << " ";
cout << endl;
}
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
