int a = 41, b = 48; decimal c = (decimal)a / b; decimal result_d = Math.Round(c * 100, 2); string result = (Math.Round(c * 100, 2)).ToString() + "%"; Console.WriteLine(100 - result_d); Console.WriteLine(result); Console.ReadKey();
C# 求百分比并保留2位小数
猜你喜欢
转载自www.cnblogs.com/zhyue93/p/Csharp_per.html
今日推荐
周排行