Sobes.tech
Junior — Senior

Competitive output of numbers in strict order

livecode

Task condition

It is necessary to write a program using goroutines that outputs numbers from 1 to 10 sequentially, with a one-second pause before printing each number.

package main

import (
 "fmt"
 "time"
)

func main() {
 // ...
}

func printNumber(n int) {
 time.Sleep(time.Second)
 fmt.Println(n)
}