divmod(n) Tcl Integer Division divmod(n)

```

```

# [NAME](#NAME)

divmod - Divide an integer by another and report quotient and remainder

# [SYNOPSIS](#SYNOPSIS)

**package require tcl 9.1**

**divmod x y**

```

```

# [DESCRIPTION](#DESCRIPTION)

The **divmod** command takes two integer numbers, *x* and *y*, and returns a list of two values. The first element of the result is the whole quotient of *x*/*y*, and the second is the remainder such that the sum of the remainder and the product of the quotient and *y* is equal to *x*.

The quotient and remainder are calculated using the same rules as for Tcl's **/** and **%** operators.

# [EXAMPLE](#EXAMPLE)

```
lassign [divmod 123 50] q r
puts "quotient=$q remainder=$r"
#       quotient=2 remainder=23
```

# [SEE ALSO](#SEE_ALSO)

[expr(n)](/man/os/tcl/expr.n), [mathfunc(n)](/man/os/tcl/mathfunc.n), [mathop(n)](/man/os/tcl/mathop.n)

# [KEYWORDS](#KEYWORDS)

division, integer value

9.1 Tcl

---

Document: divmod(n) from tcl 9.1.0-r2 (Chainguard OS)
Source: https://downloads.sourceforge.net/project/tcl/Tcl/9.1.0/tcl9.1.0-src.tar.gz
