第十节课第二个作业

2018-12-05  本文已影响0人  流影随风

 #编码

Console.WriteLine("请输入你的金额");

            double[] money = { 199.9, 250.5, 300, 499, 100 };

            double zong = 0;

            for (int i = 0; i < money.Length; i++)

            {

                Console.Write("第{0}个金额为:", i + 1);

                money[i] = Convert.ToInt32(Console.ReadLine());

                zong += money[i];

            }

            Console.WriteLine("序号\t金额");

            for (int i = 0; i < money.Length; i++)

            {

                Console.WriteLine("{0}\t{1}",i+1,money[i]);

            }

            Console.WriteLine("总金额为:{0}", zong);

            Console.ReadKey();

 #效果

上一篇 下一篇

猜你喜欢

热点阅读