# How to get an integer division in C++?

In C++, when using integer division, you will get the integer portion of the result of dividing two integers, not the decimal portion. If you want to obtain the decimal portion, you can convert one of the operands to a floating-point number or use explicit type conversion.

For example, if you have two integer variables, ‘a’ and ‘b’, and you want to get the integer part of ‘a’ divided by ‘b’, you can use the following code:

```
int result = a / b;
```

To obtain the decimal part, you can convert one of the operands to a floating point number, for example:

```
float result = static_cast<float>(a) / b;
```

Alternatively, use type conversion for explicit conversion.

```
float result = (float)a / b;
```