static void Main(string[] args)
{
double d;
int i, e;
Console.WriteLine("请输入一个整数:");
d = double.Parse(Console .ReadLine ());
i = (int)d;
if (d - i > 0.5)
e = i + 1;
else
e = i;
Console.WriteLine("四舍五入后的数是:{0}",e);
Console.Read();
Console.ReadLine();
}
原文地址:http://www.cnblogs.com/hnzsb-vv1130/p/3832308.html