在C#小数点后两位回合双? [英] Round double in two decimal places in C#?
本文介绍了在C#小数点后两位回合双?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我想圆了双重价值,在C#小数点后两位我该怎么办呢?
双inputValue将= 48.485 ;
在一轮上涨
inputValue将= 48.49;
相关报道:的 C# - 如何圆一个十进制值2小数位(在页面上输出)
解决方案
这个作品:
inputValue将= Math.Round(inputValue将,2);
I want to round up double value in two decimal places in c# how can i do that?
double inputValue = 48.485;
after round up
inputValue = 48.49;
Related: c# - How do I round a decimal value to 2 decimal places (for output on a page)
解决方案
This works:
inputValue = Math.Round(inputValue, 2);
这篇关于在C#小数点后两位回合双?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文