Skip to content

Instantly share code, notes, and snippets.

@ahoulgrave
Last active December 17, 2015 15:18
Show Gist options
  • Save ahoulgrave/5630306 to your computer and use it in GitHub Desktop.
Save ahoulgrave/5630306 to your computer and use it in GitHub Desktop.
Algoritmo para calcular promedios hasta que se ingresa -1
ALGORITMO calcularPromedios
var
int:
cantidadNumeros, numero, suma
float:
promedio
Inicio
cantidadNumeros = 0
suma = 0
promedio = 0
LEER numero
MIENTRAS numero <> -1 ENTONCES
suma = suma+numero
cantidadNumeros = cantidadNumeros+1
LEER numero
FIN_MIENTRAS
SI cantidadNumeros > 0 ENTONCES
promedio = suma/cantidadNumeros
Escribir "Promedio: ";promedio
SINO
Escribir "No se ingresaron numeros"
FIN_SI
Fin
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment