Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save shockalotti/c54915a5b8e2bb57dd82 to your computer and use it in GitHub Desktop.
Save shockalotti/c54915a5b8e2bb57dd82 to your computer and use it in GitHub Desktop.
Go golang - average array of 5 numbers
package main
import "fmt"
func main() {
var x[5]float64
x[0]=98
x[1]=93
x[2]=77
x[3]=82
x[4]=83
var total float64=0
for i:=0;i<5;i++ {
total += x[1]
}
fmt.Println(total/5)
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment