C# - Rounding Down to Nearest Integer
Just try this..
int interval = Convert.ToInt32(Math.Floor(different/increment));
Use the static Math
class:
int interval = (int)Math.Floor(difference/increment);
Math.Floor()
will round down to the nearest integer.
You can also just simply cast the result to int
. This will truncate the number.
int interval = (int)(difference / increment);