# / Operator (C# Reference)

The division operator (`/`

) divides its first operand by its second operand. All numeric types have predefined division operators.

## Remarks

User-defined types can overload the `/`

operator (see operator). An overload of the `/`

operator implicitly overloads the /= operator.

When you divide two integers, the result is always an integer. For example, the result of 7 / 3 is 2. This is not to be confused with floored division, as the `/`

operator rounds towards zero: -7 / 3 is -2.

To obtain a quotient as a rational number, use the `float`

, `double`

, or `decimal`

types. There are many ways to convert between built in numeric types.

To determine the remainder, use the remainder operator `%`

.

## Example

```
class Division
{
static void Main()
{
Console.WriteLine("\nDividing 7 by 3.");
// Integer quotient is 2, remainder is 1.
Console.WriteLine("Integer quotient: {0}", 7 / 3);
Console.WriteLine("Negative integer quotient: {0}", -7 / 3);
Console.WriteLine("Remainder: {0}", 7 % 3);
// Force a floating point quotient.
float dividend = 7;
Console.WriteLine("Floating point quotient: {0}", dividend / 3);
Console.WriteLine("\nDividing 8 by 5.");
// Integer quotient is 1, remainder is 3.
Console.WriteLine("Integer quotient: {0}", 8 / 5);
Console.WriteLine("Negative integer quotient: {0}", 8 / -5);
Console.WriteLine("Remainder: {0}", 8 % 5);
// Force a floating point quotient.
Console.WriteLine("Floating point quotient: {0}", 8 / 5.0);
}
}
// Output:
//Dividing 7 by 3.
//Integer quotient: 2
//Negative integer quotient: -2
//Remainder: 1
//Floating point quotient: 2.33333333333333
//Dividing 8 by 5.
//Integer quotient: 1
//Negative integer quotient: -1
//Remainder: 3
//Floating point quotient: 1.6
```