Question: Hi I would like to ask the result of an expression,

```
int x = 7;
double y = 2;

```

what will the type be when (x / y + 2)?

is it a double, long, int, string or byte?
thanks

Answer: 
It returns `double` type.

In `(x / y + 2)` first `x/y` performed and here variable `x` is of `int` type and `y` is of `double` type, so you are performing division operator between two different type, hence **arithmetic type conversation** happens i.e temporarily `int` gets converted or promoted to `double` i.e `x/y` yields in `double` type.

And next `(x/y)(double)` + 2`(int)` again yields in `double`.
The resulting type of the expression will be `double`. This is detailed in section 6.3.1.8 of the [C standard](http://www.open-std.org/jtc1/sc22/wg14/www/docs/n1570.pdf) which details the **Usual arithmetic conversions**:

> 
> First, if the corresponding real type of either operand is `long double`, the other operand is converted, without change of type domain, to a type whose corresponding real type is `long double`.
> 
> 
> **Otherwise, if the corresponding real type of either operand is `double`, the other operand is converted, without change of type domain, to a type whose corresponding real type is `double`.**
> 
> 
> Otherwise, if the corresponding real type of either operand is `float`, the other operand is converted, without change of type domain, to a type whose corresponding real type is `float`.
> 
> 
> Otherwise, the integer promotions are performed on both operands.
> 
> 
> 

The paragraph in bold states that if one operand is a `double` and the other has an integer type, both operands will have type `double`. This is the case in your expression.

Since `x` has type `double` and `y` has type `int`, the value of `y` is converted to `double` and the full expression `x / y` has type `double`. From there, `x / y` has type double and `2` has type `int`, the value `2` is converted to `double` and so `x / y + 2` has type `double`.