Write the definition of a function named sumArray that receives two parameters: an array of element type int and an int that contains the number of elements of the array. The function returns the sum of the elements of the array as an int.
.
.
Click on the title for the solution
.
.
int sumArray(int array[], int n)
{int sum=0;
for (int i=0;i<n;i++)
{sum+=array[i];}
return sum;}
.
Click on the title for the solution
.
.
This is the answer:
:
int sumArray(int array[], int n)
{int sum=0;
for (int i=0;i<n;i++)
{sum+=array[i];}
return sum;}
Comments
Post a Comment