开发者

Rounding to unit above with C#

开发者 https://www.devze.com 2022-12-20 13:45 出处:网络
How to I round a decimal upwards to the nearest int. i.e. 1.2 --开发者_开发问答-> 2 5.6 ---> 6

How to I round a decimal upwards to the nearest int.

i.e.

1.2 --开发者_开发问答-> 2
5.6 ---> 6
79.9 ---> 80
85.01 ---> 86

(int)Math.Round(count / (decimal)rows, MidpointRounding.AwayFromZero)


Math.Ceiling is your friend

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号