double num = 5.5; int intpart = (int)num; double decpart = num - intpart; if (decpart > .5) { intpart = intpart + 1; }
double val = Convert.ToDouble(textBox1.Text); MessageBox.Show(Math.Round((val % .5) == 0 ? (val - 0.1) : val).ToString());
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)