Skip to content

Instantly share code, notes, and snippets.

@vepo
Created July 7, 2022 13:50
Show Gist options
  • Save vepo/98829c19624ca9c9eaa59f5ca373790a to your computer and use it in GitHub Desktop.
Save vepo/98829c19624ca9c9eaa59f5ca373790a to your computer and use it in GitHub Desktop.
class Media {
void mediaImperativa(int[] valores) {
int soma = 0;
for (int valor : valores) {
soma += valor;
}
return soma / valores.length;
}
void mediaDeclarativa(int[] valores) {
return soma(valores) / tamanho(valores);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment