C#里两个整型的数相除,会自动取整。
如果要四舍五入,就要首先转换成Double型,然后利用Math.Round四舍五入。
具体代码如下
Double avg = Math.Round((Double)a / (Double)b, 2);
转载于:https://www.cnblogs.com/haoch_00/archive/2009/10/10/1580399.html
转载于:https://www.cnblogs.com/haoch_00/archive/2009/10/10/1580399.html