#include<iostream>
using namespace std;
main()
{
int arrayOne[20], arrayTwo[20], a, b;
// The user is asked for the number of elements in the array
cout << "How many elements are in the array? ";
cin >> b;
cout << "Please type the elements in array 1" << endl;
for ( a = 0 ; a < b ; a++ )
cin >> arrayOne[a];
cout << "Please type the elements in array 2 " << endl;
for ( a = 0 ; a < b ; a++ )
cin >> arrayTwo[a];
cout << "The average of elements of two arrays " << endl;
for ( a = 0 ; a < b ; a++ )
cout << float(arrayOne[a] + arrayTwo[a])/2 << endl;
return 0;
}
Comments