Junior — Senior
Batch sequential output of numbers with pauses
livecode
Task condition
It is necessary to modify the existing code so that:
- numbers from 1 to 10 are displayed in groups of five (the first set — 1‑5, the second — 6‑10);
- within each group, there is a one-second delay between printing individual numbers (this is implemented by the printNumber function);
- after completing the output of each group, a pause of two seconds should occur.
import (
"fmt"
"time"
)
func main () {
for i:= 1; i < 11; i++ {
}
func printNumber(n int) {
time.Sleep(time.Second)
fmt.Println(n)
}
}