trying_out_go/average.go
2023-10-16 12:44:08 -04:00

14 lines
249 B
Go

package main
import "fmt"
func average() {
numbers := [3]float64{71.8, 56.2, 89.5}
var sum float64 = 0
for _, number := range numbers {
sum += number
}
sampleCount := float64(len(numbers))
fmt.Printf("Average: %0.2f\n", sum/sampleCount)
}