multiply two numbers in go

To multiply two numbers in Go, we can simply use the * operator. Here's an example:

main.go
package main

import "fmt"

func main() {
    a := 5
    b := 10
    c := a * b
    fmt.Println(c) // Output: 50
}
115 chars
11 lines

In the code above, we first declare two variables a and b, and initialize them with the values 5 and 10 respectively.

We then use the * operator to multiply the two numbers and assign the result to a new variable c.

Finally, we print the value of c to the console using the fmt package's Println function, which will output the result 50.

gistlibby LogSnag