Create the function exactly as needed to make this main func


Create the function exactly as needed to make this main function work: int main() {const int size = 4; int myList[Size] = {18, 52, 76, 101}; cout

Solution

#include <iostream>
using namespace std;

int printSum(int list[4], int size);

int main() {
const int size = 4;
int myList[size]= {18, 52, 76, 101};
   cout<<printSum(myList, size)<< endl;
   return 0;
}

int printSum(int list[4], int size) {
int sum = 0;
for (int i = 0; i < size ; ++i)
{
sum = sum + list[i];
}
return sum;
}

 Create the function exactly as needed to make this main function work: int main() {const int size = 4; int myList[Size] = {18, 52, 76, 101}; cout Solution#incl

Get Help Now

Submit a Take Down Notice

Tutor
Tutor: Dr Jack
Most rated tutor on our site