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
How do you handle HTTP Client server load balancing in Go?
Web Application to generate QR code in Golang
Cannot convert <type1> to <type2> error in Golang
How do you send an HTTP GET request with an HTTP client in Go?
GO language program with an example of Hash Table
Golang program for implementation of Linked List
Declaration of a struct type
Illustration of Checkpoint Synchronization in Golang
Example of Interface with Type Embedding and Method Overriding in GO language
Interface embedding another interface in Go Programming Language