//Patriche Robert #include #include #include using namespace std; int sommaIndiciPari(int arr[], int size); int main() { const int DIM = 15; int numeri[DIM]; srand(time(0)); cout << "Array: "; for (int i = 0; i < DIM; i++) { numeri[i] = rand() % 100 + 1; cout << numeri[i] << " "; } cout << endl; int somma = sommaIndiciPari(numeri, DIM); cout << "Somma degli elementi con indice pari: " << somma << endl; return 0; } int sommaIndiciPari(int arr[], int size) { int somma = 0; for (int i = 0; i < size; i++) { if (i % 2 == 0) { somma += arr[i]; } } return somma; }