+ 1

Helpe to solve this?

package main import "fmt" //create the route() function func main() { var n int fmt.Scanln(&n) var cities []string //take n strings as input and append them to the slice // route(cities...) }

10th Nov 2022, 12:13 PM
Fahad Khan
Fahad Khan - avatar
1 Answer
0
package main import "fmt" // create the route() function func route(cities ...string) { // perform routing logic using the cities slice fmt.Println("Routing:", cities) } func main() { var n int fmt.Scanln(&n) var cities []string for i := 0; i < n; i++ { var city string fmt.Scanln(&city) cities = append(cities, city) } route(cities...) }
13th Jun 2023, 9:22 PM
Axel00x
Axel00x - avatar