首页 > 代码库 > C# 简单的特殊输出

C# 简单的特殊输出

   

    class Program
    {
        static void Main(string[] args)
        {
            int i = 940;
            int j = 73;
            Console.WriteLine("{0,5}\n+{1,4}\n------\n{2,4}",i,j,i+j);

 

            decimal a1 = 940.23m;
            decimal a2 = 73.7m;
            Console.WriteLine("{0,9:C2}\n+{1,9:C2}\n-----\n{2,9:C2}",a1,a2,a1+a2);


            Console.ReadKey();
        }
    }

输出结果为: