Correct. Also see the C# Reference for the division operator.
http://msdn.microsoft.com/en-us/library/3b1ff23f.aspx
"When you divide two integers, the result is always an integer. For example, the result of 7 / 3 is 2. To determine the remainder of 7 / 3, use the remainder operator (%). To obtain a quotient as a rational number or fraction, give the dividend or divisor type float or type double."
Sample results:
7 / 3 = 2
-7 / 3 = -2
7 % 3 = 1
7 / 3.0 = 2.33333333333333
7.0 / 3 = 2.33333333333333
8 / 5 = 1
8 / -5 = -1
8 % 5 = 3
8 / 5.0 = 1.6
8.0 / 5 = 1.6
Leave a comment: