C#中保留2位小数

 

 

public static void Method()
        {
            double a = 1.991;
            a = Math.Round(a);
            Console.WriteLine("a = {0}",a);
            Console.WriteLine("a = {0}",a.ToString("0.00"));
            Console.WriteLine("a = {0:N2}",1.4);
        }

posted @ 2015-07-01 15:04  ChuckLu  阅读(344)  评论(0编辑  收藏  举报