The value "1" is be default an integer. The value n is an integer. The operation (1/n) performs integer division, which truncates remainders. The result, which should be 0, will be stored in the double variable inis, so it is casted to double value before being stored.

To get the division operation for doubles, at least one of the operands must be a double. You can cast either one (for instance 1/(double)n or 1/double(n)), or you can declare 1 to be a constant of type double (1.0/n)