tgoop.com/golangprofi/257
Create:
Last Update:
Last Update:
Ответpackage main
Пишите свое решение в комментариях👇
import (
"fmt"
"io"
"os"
)
func FprintArray[T any](w io.Writer, arr []T) {
if len(arr) == 0 {
return
}
fmt.Fprintf(w, "%v", arr[0])
for _, obj := range arr[1:] {
fmt.Fprintf(w, ", %v", obj)
}
}
func main() {
arr := []int{155, 133, 127, 123, 117, 105, 104, 98, 94, 90, 77, 76, 70, 55, 50, 45, 43, 42, 37, 29}
fmt.Print("[")
FprintArray(os.Stdout, arr)
fmt.Println("]")
}