2018-11-21

2018-11-21  本文已影响0人  晨颜

作业1:输入一个数,生存这个数的加发表

Console.WriteLine("请输入一个数");

            inti = 0;inta=Convert.ToInt32(Console.ReadLine());

            for(i = 0; i <= a; i++)

            {

                Console.WriteLine("{0}+{1}={2}", i, a - i,a);

            }

            Console.ReadKey();

运行结果

作业2:生成九九乘法表

for(inti=1;i<=9;i++)

            {

                Console.WriteLine(" ");

                for(intj = 1; j <= i;j++ )

                {

                    Console.Write("{0}*{1}={2} ", j, i, j* i);

                }

            }

            Console.ReadKey();

for(inti=1;i<=9;i++)

            {

                Console.WriteLine(" ");

                for(intj = 1; j <= i;j++ )

                {

                    Console.Write("{0}*{1}={2} ", j, i, j* i);

                }

            }

            Console.ReadKey();

上一篇下一篇

猜你喜欢

热点阅读