如何圆一个整数的密切一百次呢。 [英] How to round a integer to the close hundred?

查看:185
本文介绍了如何圆一个整数的密切一百次呢。的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我不知道是我的命名是正确的!无论如何,这些都是整我有,例如:

I don't know it my nomenclature is correct! Anyway, these are the integer I have, for example :

76
121
9660

和我想他们舍入到接近百家,比如他们必须成为:

And I'd like to round them to the close hundred, such as they must become :

100
100
9700

我怎样才能做到这一点在C#中更快吗?我想一个算法,但也许有C#的一些实用程序?

How can I do it faster in C#? I think about an algorithm, but maybe there are some utilities on C#?

推荐答案

尝试 Math.Round 方法。具体方法如下:

Try the Math.Round method. Here's how:

Math.Round(76d / 100d, 0) * 100;
Math.Round(121d / 100d, 0) * 100;
Math.Round(9660d / 100d, 0) * 100;

这篇关于如何圆一个整数的密切一百次呢。的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆