When you write x/y with both x and y integers, you are doing integer division. This truncates the fractional portion of any result you get. Thus, 5/2=2.5 truncates to 2 and 19/2=9.5 truncates to 9. I can't explain the other result though...are you sure you read it correctly?
quotient is declared as an integer. It should be a double as well since x and y are doubles. Even if x and y aren't being converted to ints before the division, the answer is being forced into one so you are losing anything after the decimal.