C#汇总值!!! [英] C# Round Up Values !!!

查看:59
本文介绍了C#汇总值!!!的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想将一些值四舍五入到不带小数位的位置.但我想要这样:

例如,如果Doubel Val = 3.2,那么我需要将此值四舍五入为4.0,而不是3.0.任何人都可以在此问题上找到解决方案.
Math.Round(Val,MidpointRounding.AwayFromZero);
但这并不能带来正确的解决方案!!!
val = System.Math.Ceiling(val);

祝你有美好的一天


I want to Round up Some values to a With out Decimal places. but i want it as this :

Ex if Doubel Val = 3.2 then i need to round up this Value as a 4.0 Not as 3.0. Can anyone have a Solution on this matter.
Math.Round(Val, MidpointRounding.AwayFromZero);
But it does not bring the Right Solution!!!

解决方案

Hi,

val = System.Math.Ceiling(val);

Have a nice day


这篇关于C#汇总值!!!的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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