Programming Language: Golang

Namespace/Package Name: math/big

Class/Type: Int

Method/Function: Quo

Examples at hotexamples.com: 18

The package library for the `math/big` Int Quo function is the Go standard library `math/big`.

The `Quo` method calculates the quotient of two `big.Int` values and returns a new `big.Int` value. It performs integer division, discarding any remainder.

**Example 1:**

In this example, we create two `big.Int` values `a` and `b`, then calculate the quotient of `a` divided by `b` using the `Quo` method. The result is stored in a new `big.Int` value `quotient` and printed to the console.

**Example 2:**

The `Quo` method calculates the quotient of two `big.Int` values and returns a new `big.Int` value. It performs integer division, discarding any remainder.

import ( "fmt" "math/big" ) func main() { a := big.NewInt(10) b := big.NewInt(3) quotient := new(big.Int) quotient.Quo(a, b) fmt.Println(quotient) // Output: 3 }

In this example, we create two `big.Int` values `a` and `b`, then calculate the quotient of `a` divided by `b` using the `Quo` method. The result is stored in a new `big.Int` value `quotient` and printed to the console.

import ( "fmt" "math/big" ) func main() { a := big.NewInt(5) b := big.NewInt(0) quotient := new(big.Int) quotient.Quo(a, b) fmt.Println(quotient) // Output: panic: division by zero }In this example, we attempt to calculate the quotient of `a` divided by `b`, which is equivalent to dividing by zero. This will result in a runtime panic. It is important to note that the `big.Int` values passed as arguments to the `Quo` method must not be nil, otherwise a runtime error will occur.

Frequently Used Methods

Frequently Used Methods

Frequently Used Methods

Related in langs

Frequently Used Methods

Related