2023-10-25 11:55:04 -04:00
|
|
|
package main
|
|
|
|
|
|
|
|
import (
|
|
|
|
"fmt"
|
2023-10-25 12:57:21 -04:00
|
|
|
"log"
|
2023-10-25 11:55:04 -04:00
|
|
|
"os"
|
2023-10-25 12:57:21 -04:00
|
|
|
"strconv"
|
2023-10-25 11:55:04 -04:00
|
|
|
)
|
|
|
|
|
2023-10-25 12:57:21 -04:00
|
|
|
func main() {
|
|
|
|
arguments := os.Args[1:]
|
|
|
|
var sum float64 = 0
|
|
|
|
for _, argument := range arguments {
|
|
|
|
number, err := strconv.ParseFloat(argument, 64)
|
|
|
|
if err != nil {
|
|
|
|
log.Fatal(err)
|
|
|
|
}
|
|
|
|
sum += number
|
|
|
|
}
|
|
|
|
sampleCount := float64(len(arguments))
|
|
|
|
fmt.Printf("Average: %0.2f\n", sum/sampleCount)
|
2023-10-25 11:55:04 -04:00
|
|
|
}
|