Skip to content

Instantly share code, notes, and snippets.

@7yan00
Last active August 29, 2015 14:12
Show Gist options
  • Save 7yan00/efa4068a19b1153676a4 to your computer and use it in GitHub Desktop.
Save 7yan00/efa4068a19b1153676a4 to your computer and use it in GitHub Desktop.
poh01.go
package main
import (
"bufio"
"fmt"
"os"
"strconv"
)
func main() {
var n int
scanner := bufio.NewScanner(os.Stdin)
scanner.Scan()
n, _ = strconv.Atoi(scanner.Text())
total := 0
for i := 0; i < n; i++ {
var a int
scanner.Scan()
a, _ = strconv.Atoi(scanner.Text())
total = total + a
}
fmt.Println(total)
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment