> ## Documentation Index
> Fetch the complete documentation index at: https://docs.starknet.io/llms.txt
> Use this file to discover all available pages before exploring further.

# core::traits::DivRem

Performs truncated division and remainder.
This trait provides a way to efficiently compute both the quotient and remainder in a single
operation. The division truncates towards zero, matching the behavior of the `/` and `%`
operators.

## Signature

```rust theme={null}
pub trait DivRem
```

## Examples

```rust theme={null}
assert!(DivRem::div_rem(7_u32, 3) == (2, 1));
```

## Trait functions

### div\_rem

Performs the `/` and the `%` operations, returning both the quotient and remainder.

#### Signature

```rust theme={null}
fn div_rem(lhs: T, rhs: NonZero) -> (T, T)
```

#### Examples

```rust theme={null}
assert!(DivRem::div_rem(12_u32, 10) == (1, 2));
```
