如何使圆形百分比总计100%在C#中

发布于 2025-01-27 16:40:49 字数 452 浏览 5 评论 0原文

我想知道价格上涨的百分比上涨,我有3个文本框:
txtcost_price,salesprice和txtmarkup。 “ IS = 54300
“ txtmarkup”的结果= 3.42857142857143
如何使txtmarkup产生的百分比在逗号之后没有多个数字?我使用印尼货币。

double CostPrice; double results, SalesPrice;

CostPrice = Convert.ToInt32(C_1_1_txtCost_Price.Text); 
SalesPrice = Convert.ToInt32(C_1_3_SalesPrice.Text); 
results = (SalesPrice - CostPrice) / CostPrice * 100;
 
C_1_2_txtMarkup.Text = Convert.ToString(results);

I want to know the percentage increase in the price being rounded off, I have 3 textboxes in winforms :
txtCost_Price, SalesPrice, and txtMarkup.
value "txtCost_Price" is = 52500
and the value of "SalesPrice" is = 54300
result of "txtMarkup" = 3.42857142857143
how to make percentage result from txtMarkup not have multiple numbers after comma? I use Indonesian currency.

double CostPrice; double results, SalesPrice;

CostPrice = Convert.ToInt32(C_1_1_txtCost_Price.Text); 
SalesPrice = Convert.ToInt32(C_1_3_SalesPrice.Text); 
results = (SalesPrice - CostPrice) / CostPrice * 100;
 
C_1_2_txtMarkup.Text = Convert.ToString(results);

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。
列表为空,暂无数据
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文