divide two numbers in go

To divide two numbers in Go, use the / operator. Here's an example:

main.go
package main

import (
	"fmt"
)

func main() {
	a := 10 
	b := 2
	
	c := a / b
	
	fmt.Println(c) // Output: 5
}
112 chars
15 lines

In the example above, we declare two variables a and b and assign them the values of 10 and 2 respectively. We then use the / operator to perform the division operation and assign the result to a new variable c. Finally, we print out the value of c which is expected to be 5.

gistlibby LogSnag