본문 바로가기

프로그래밍

마름모 찍기




int i, j;

            Console.Write("숫자입력 - ");
            int Num = int.Parse(Console.ReadLine());

            for (i = 1; i <= Num; i++)
            {
                for (j = 1; j <= Num-i; j++)
                {
                   Console.Write("  ");
                }

                for (j = 1; j <= 2*i-1; j++)
                {
                    Console.Write(" *");
                }
               
                Console.WriteLine();
            }

            for (i = Num-1; i >= 0; i--)
            {
                for (j = 1; j <= Num-i; j++)
                {
                    Console.Write("  ");
                }
                for (j = 2 * i - 1; j > 0; j--)
                {
                    Console.Write(" *");
                }
                Console.WriteLine();
            }


[푸르딩]
머리가 후달리는듯..
엄청 오래걸렸네 ㅠㅠ