How to perform basic arithmetic operations (addition, subtraction, multiplication, division) in Go?

In Go, the basic arithmetic operations can be performed using the standard arithmetic operators. Here's how you can perform these operations:

  1. Addition: Use the + operator to add two numbers together. For example:
a := 5 b := 3 result := a + b fmt.Println(result) // Output: 8
  1. Subtraction: Use the - operator to subtract one number from another. For example:
a := 8 b := 3 result := a - b fmt.Println(result) // Output: 5
  1. Multiplication: Use the * operator to multiply two numbers. For example:
a := 5 b := 3 result := a * b fmt.Println(result) // Output: 15
  1. Division: Use the / operator to divide one number by another. For example:
a := 10 b := 2 result := a / b fmt.Println(result) // Output: 5

Note that Go automatically handles the correct order of operations based on the arithmetic operators being used.