Sobes.tech
Junior — Senior

Batch competitive output of numbers

livecode

Task condition

It is necessary to implement a concurrent output of numbers from 1 to 10, five at a time, while maintaining the order of their printing. The next batch of five numbers should only start after the previous one has completely finished.

package main

import (
    "fmt"
    "time"
)

func main() {
    // implement the logic to print numbers in batches
}

func displayNumber(value int) {
    time.Sleep(time.Second)
    fmt.Println(value)
}