Created
July 7, 2022 13:50
-
-
Save vepo/98829c19624ca9c9eaa59f5ca373790a to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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