Declaration and Initialization in practice

Report a typo

Suppose you have a program that takes as an input three random integer variables a, b and c.

Create a slice of integers intSlice containing the a, b, and c variables, and then print intSlice to the terminal.

Sample Input 1:

1 2 3

Sample Output 1:

[1 2 3]
Write a program in Go
package main

import "fmt"

func main() {
var a, b, c int
fmt.Scanln(&a, &b, &c)

// Create intSlice containing the a, b and c variables below:
intSlice := ?

fmt.Println(?) // print intSlice here!
}
___

Create a free account to access the full topic