Skip to content

Instantly share code, notes, and snippets.

@wlensinas
Created December 29, 2018 06:21
Show Gist options
  • Save wlensinas/60c1c6f9240a87c16cddd25a2d499bc6 to your computer and use it in GitHub Desktop.
Save wlensinas/60c1c6f9240a87c16cddd25a2d499bc6 to your computer and use it in GitHub Desktop.
Platzi - Flutter - Primer reto
void main() {
double promedio = 0;
double acumulador = 0;
int mayor = 0;
int menor = 200;
var ages = [33, 15, 27, 40, 22];
var indice = ages.length;
int edad = 0;
for (int i = 0; i < indice; i++) {
edad = ages[i];
if (edad > mayor) {
mayor = edad;
} else if (edad < menor) {
menor = edad;
}
acumulador = acumulador + edad;
}
promedio = acumulador / indice;
print('La edad mayor es: $mayor');
print('La edad menor es: $menor');
print('La edad promedio es: $promedio');
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment