Skip to content

Instantly share code, notes, and snippets.

@wrpinheiro
Last active April 10, 2020 20:33
Show Gist options
  • Save wrpinheiro/859a30d8c29778238f111708442bf521 to your computer and use it in GitHub Desktop.
Save wrpinheiro/859a30d8c29778238f111708442bf521 to your computer and use it in GitHub Desktop.
algoritmos-corretude
public int somaNumPares(int[] A) {
int i = 0;
int soma = 0;
int n = A.length;
while(i < n) {
if(A[i] % 2 == 0)
soma = soma + A[i];
i++;
}
return soma;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment