Application

Report a typo

Emma has just finished learning about channels. She has created a Go program with the sender and receiver functions that interact with the ch channel.

However, when Emma tried to run her program, she got various syntax errors. Please help Emma fix the mistakes in the sender and receiver functions to make her program work properly.

Sample Input 1:

3

Sample Output 1:

111
Write a program in Go
package main

import "fmt"

func sender(ch chan int) {
1 -> ch
}

func receiver(ch chan int) {
number <- := ch
fmt.Print(number)
}

// do not change code below
func main() {
var amount int
fmt.Scan(&amount)

ch := make(chan int)
for i := 0; i < amount; i++ {
go sender(ch)
}

for i := 0; i < amount; i++ {
receiver(ch)
}
}
___

Create a free account to access the full topic