通过本文主要向大家介绍了c#四舍五入,c#四舍五入函数,c#四舍五入取整,c#四舍五入取整函数,c#中四舍五入等相关知识,希望对您有所帮助,也希望大家支持linkedu.com www.linkedu.com
效果:
说明:输入小数,然后输入要保留的位数,
事件:点击Button
代码:
private void button1_Click(object sender, EventArgs e)
{
textBox3.Text=Convert.ToString(Math.Round(Convert.ToDouble(textBox1.Text.Trim()),Convert.ToInt16(textBox2.Text.Trim())));
}
</div>