Skip to content

Instantly share code, notes, and snippets.

@GhazeyAhmed
Created May 22, 2022 15:51
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save GhazeyAhmed/296761efba6d401f73f402f401eb16dc to your computer and use it in GitHub Desktop.
Save GhazeyAhmed/296761efba6d401f73f402f401eb16dc to your computer and use it in GitHub Desktop.
Read Numbers Main
func main() {
numbers, err := GetFloats("numbers.txt")
if err != nil {
log.Fatal(err)
}
var sum float64 = 0
for _, number := range numbers {
sum += number
}
fmt.Printf("Sum: %0.2f\n", sum)
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment