Created
July 28, 2017 21:30
-
-
Save jreisinger/ed2b5a8b1df2fadc1f1c78fc31c7c05f to your computer and use it in GitHub Desktop.
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
package main | |
import "fmt" | |
func main() { | |
// array of 5 elements | |
x := [5]float64{98, 93, 77, 82, 83} | |
var total float64 = 0 | |
// we don't need array index -> _ | |
for _, value := range x { | |
total += value | |
} | |
fmt.Println(total / float64(len(x))) | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment