This commit is contained in:
wagslane
2023-05-01 15:25:27 -06:00
parent f8912668b8
commit 9be3074de6
868 changed files with 58698 additions and 2 deletions

View File

@@ -0,0 +1,35 @@
package main
import (
"fmt"
"time"
)
func concurrrentFib(n int) {
// ?
}
// TEST SUITE - Don't touch below this line
func test(n int) {
fmt.Printf("Printing %v numbers...\n", n)
concurrrentFib(n)
fmt.Println("==============================")
}
func main() {
test(10)
test(5)
test(20)
test(13)
}
func fibonacci(n int, ch chan int) {
x, y := 0, 1
for i := 0; i < n; i++ {
ch <- x
x, y = y, x+y
time.Sleep(time.Millisecond * 10)
}
close(ch)
}