That code works, what is your problem?
If you don't specify an output type, your result could be truncated to the most restricted data type.
In that example the output is truncated to an int value. You can think of it like significant digits, you can only have as many as the least percise value.
You might find better results like this:
-
int x = 4;
-
double y = 7;
-
Console.WriteLine( (double)(x / y) );
-
//or
-
Console.WriteLine( ((double)x) / y );
-
You need to explicit cast the value to get a better result.
ALSO:
I have removed your double post, in the future please refrain from posting the question more then once.
MODERATOR