---
title: "quotientAndRemainder(dividingBy:)"
framework: swift
role: symbol
role_heading: Instance Method
path: "swift/int16/quotientandremainder(dividingby:)"
---

# quotientAndRemainder(dividingBy:)

Returns the quotient and remainder of this value divided by the given value.

## Declaration

```swift
func quotientAndRemainder(dividingBy rhs: Self) -> (quotient: Self, remainder: Self)
```

## Parameters

- `rhs`: The value to divide this value by.

## Return Value

Return Value A tuple containing the quotient and remainder of this value divided by rhs. The remainder has the same sign as lhs.

## Discussion

Discussion Use this method to calculate the quotient and remainder of a division at the same time. let x = 1_000_000 let (q, r) = x.quotientAndRemainder(dividingBy: 933) // q == 1071 // r == 757
