当前位置:编程学习 > C#/ASP.NET >>

c#实现奇数魔方算法

static void Main(string[] args)
        {
            string flag = "y";
            while (flag == "Y" || flag == "y")
            {
                Console.WriteLine("请输入一个奇数:");
                string s = Console.ReadLine();
                if (s.Length > 1)
                    return;
                if (!char.IsNumber(s,0))
                    return;
                int nn = Convert.ToInt32(s);
                if (nn != 0 && nn / 2 != 0)
                {
                    int[,] arryss = Demo(nn);
                    for (int i = 0; i < nn; i++)
                    {
                        for (int j = 0; j < nn; j++)
                        {
                            Console.Write(arryss[i, j] + " ");
                            if ((j + 1) % nn == 0)
                            {
                                Console.Write(" "

补充:软件开发 , C# ,
CopyRight © 2022 站长资源库 编程知识问答 zzzyk.com All Rights Reserved
部分文章来自网络,