3
This function should add the pair, but it is not, I did not understand the pq.
#include <stdio.h>
int somapar(int vet[], int n) {
int soma = 0, i;
for (i = 0; i < n; i++) {
if (vet[n] % 2 == 0)
soma = soma + vet[n];
}
return soma;
}
int main () {
int v[20] = {2, 1, 8, 3, 4};
int a;
a = somapar (v, 5);
printf ("%d ", a);
return 0;
}