I have a C# app that is calculating some numbers. I need to round down.
var increment = 1.25; var result = 50.45 - 23.70; // equals 26.75 int interval = difference / increment; // result is 21.4. However, I just want 21
I have to get the interval to an int. At the same time, I cannot just use Convert.ToInt32 because of its rounding behavior. I always want the lowest whole number. However, I'm not sure how.
interval
int
Convert.ToInt32
Just try this..
int interval = Convert.ToInt32(Math.Floor(different/increment));
1.4m articles
1.4m replys
5 comments
56.9k users