Answer and Explanation:
#include <iostream>
using namespace std;
int printEven(int array[],int n)
{
int count=0;
for(int i=0;i<n;i++)
{
if(array[i]%2==0)
{
count++;
cout<<array[i]<<" ";
}
}
return count;
}
void printAll(int array[],int n)
{
for(int i=0;i<n;i++)
{
cout<<array[i]<<" ";
}
}
int computeTotalOdds(int array[],int n)
{
int count=0;
for(int i=0;i<n;i++)
{
if(array[i]%2!=0)
{
count++;
}
}
return count;
}
int main()
{
int array1[20] = {3, 18, 1, 25, 4, 7, 30, 9, 80, 16, 17};
int numElements = 11;
cout << "Part 1" << endl;
cout<<array1[4]<<" "<<array1[9];
cout << endl;
cout<<array1[0]<<" "<<array1[8];
cout << endl;
array1[2]=12;
cout << "\nPart 2" << endl;
printAll(array1,numElements);
cout << "\nPart 3" << endl;
int evens;
evens=printEven(array1,numElements);
// This will print the number of evens in the array.
cout << endl << evens;
cout << "\nPart 4" << endl;
int total;
total=computeTotalOdds(array1,numElements);
cout << endl << total;
return 0;
}