Created
December 29, 2018 06:21
-
-
Save wlensinas/60c1c6f9240a87c16cddd25a2d499bc6 to your computer and use it in GitHub Desktop.
Platzi - Flutter - Primer reto
This file contains hidden or 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
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