Skip to content

Instantly share code, notes, and snippets.

@parzibyte
Created October 16, 2019 18:38
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save parzibyte/22c89f97e2164ff165a3b845f63b0a17 to your computer and use it in GitHub Desktop.
Save parzibyte/22c89f97e2164ff165a3b845f63b0a17 to your computer and use it in GitHub Desktop.
package main
import "fmt"
func main() {
calificaciones := [10] int {78, 20, 55, 90, 99, 78, 96, 50, 80, 100};
sumatoria := 0 //Aquí iremos sumando cada valor
/*
Recorrer el arreglo
*/
for _, calificacion := range calificaciones{
sumatoria += calificacion
}
//El promedio es dividir la sumatoria entre el número de calificaciones
promedio := sumatoria / len(calificaciones)
fmt.Println("El promedio es", promedio)
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment