The reason for this is that there is no remainder when performing division with a type capable of representing the actual answer.
E.g.
11 / 4 => 2, remainder 3 (where 3 = 11 % 4)
but 11.0 / 4.0 = 2.75, no remainder ever!

06-20-2009

ninety3gd

Quote:

The reason for this is that there is no remainder when performing division with a type capable of representing the actual answer.
E.g.
11 / 4 => 2, remainder 3 (where 3 = 11 % 4)
but 11.0 / 4.0 = 2.75, no remainder ever!

You can use % with C# or Java with real values...

06-20-2009

Sharke

Why doesn't C just do an automatic conversion from double to int in this case?