在c#中除数取整使用的是:
5%2 =3
另外还有以下的方法:
- Math.Round:四舍六入五取整
-
- Math.Ceiling:向上取整,只要有小数都加1
-
- Math.Floor:向下取整,总是舍去小数
-
-
-
- 使用的时候,说函数具有二义性。所以使用如下:
-
- (int)Math.Ceiling((double)xor/12);
-
- Xor/12取整还是double型是具有二义性的
在c#中除数取整使用的是:
5%2 =3
另外还有以下的方法:
- Math.Round:四舍六入五取整
-
- Math.Ceiling:向上取整,只要有小数都加1
-
- Math.Floor:向下取整,总是舍去小数
-
-
-
- 使用的时候,说函数具有二义性。所以使用如下:
-
- (int)Math.Ceiling((double)xor/12);
-
- Xor/12取整还是double型是具有二义性的