Created
February 19, 2022 14:37
-
-
Save kanguki/458857aa42d1eb766abe93515e32c26c to your computer and use it in GitHub Desktop.
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 ( | |
"bufio" | |
"fmt" | |
"os" | |
"strconv" | |
) | |
func main() { | |
arr := readStdin() | |
fmt.Println(arr) | |
} | |
func readStdin() []int { | |
arr := []int{} | |
input := bufio.NewScanner(os.Stdin) | |
for input.Scan() { | |
t := input.Text() | |
if t == "" { | |
break | |
} | |
n, _ := strconv.Atoi(t) | |
arr = append(arr, n) | |
} | |
return arr | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment