比如1234,取十位数=1230,百位数整数=1200

解决方案 »

  1.   

            int i = 1234;
            double x = Math.Floor(i * 1.0 / 100) * 100;
      

  2.   

    public static decimal Floor(decimal d);
            //
            // 摘要:
            //     返回小于或等于指定双精度浮点数的最大整数。
            //
            // 参数:
            //   d:
            //     一个双精度浮点数。
            //
            // 返回结果:
            //     小于或等于 d 的最大整数。如果 d 等于 System.Double.NaN、System.Double.NegativeInfinity 或
            //     System.Double.PositiveInfinity,则返回该值。
      

  3.   

    Math.floor(2.1)=2  就是取整
      

  4.   

    四舍五入取整:Math.rint(2)=2
    四舍五入取整:Math.rint(2.1)=2
    四舍五入取整:Math.rint(-2.5)=-2
    四舍五入取整:Math.rint(2.5)=2
    四舍五入取整:Math.rint(2.9)=3
    四舍五入取整:Math.rint(-2.9)=-3
    四舍五入取整:Math.rint(-2.49)=-2
    四舍五入取整:Math.rint(-2.51)=-3