GO supports the standard arithmetic operators: (Addition, Subtraction, Multiplication, Division,Remainder)
Basic GO program to display of standard arithmetic operators with 2 integer values.It contains the main package line, the fmt import line, and the main function declaration, and it uses the Println function.
Example
package main
import "fmt"
func main() {
fmt.Println("1 + 2 = ",1+2) // Addition
fmt.Println("5 * 2 = ",5*2) // Multiplication
fmt.Println("10 - 2 = ",10-2) // Subtraction
fmt.Println("10 / 2 = ",10/2) // Division
fmt.Println("10 % 2 = ",10%2) // Remainder
}
Most Helpful This Week
Web Application to generate QR code in Golang
How do you send an HTTP GET request with an HTTP client in Go?
Interface embedding and calling interface methods from another package in Go (Golang)
Converting Int data type to Float in Go
Create and Print Multi Dimensional Slice in Golang
Golang program to print a matrix in Spiral Format