Created
May 14, 2014 02:55
-
-
Save shockalotti/c54915a5b8e2bb57dd82 to your computer and use it in GitHub Desktop.
Go golang - average array of 5 numbers
This file contains 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() { | |
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