ส่วนตัว

กระทู้คำถาม
static void Main(string[] args)
        {
         Console.Write("Enter number : ");
         int a = int.Parse(Console.ReadLine());
         Console.WriteLine();
         if (a >= 2 || a <= 10)
         {
                for (int i = a; i >= 1; i--)
                {
                 for (int j = 1; j <= i; j++)
                 {
                        Console.Write(j);
                 }
                 Console.WriteLine();
                 for (int b = a; b >= i; b--)
                 {
                        Console.Write(" ");
                 }
                }
         }
         Console.WriteLine();
         Console.WriteLine("==================================================================");
         Console.WriteLine();
         if (a >= 2 || a <= 10)
         {
                for (int i = 1; i <= a; i++)
                {
                 for (int j = a; j >= i; j--)
                 {
                        Console.Write(i);
                 }
                 Console.WriteLine();
                }
         }
         Console.WriteLine();
         Console.WriteLine("==================================================================");
         Console.WriteLine();
         if (a >= 2 || a <= 10)
         {
                for (int i = 1; i <= a; i++)
                {
                 for (int j = 1; j <= a; j++)
                 {
                        if (i == 1 || i == a || j == 1 || j == a)
                        {
                         Console.Write(i);
                        }
                        else
                        {
                         Console.Write(" ");
                        }
                 }
                 Console.WriteLine();
                }
         }
         Console.ReadLine();
        }
แก้ไขข้อความเมื่อ
แสดงความคิดเห็น
โปรดศึกษาและยอมรับนโยบายข้อมูลส่วนบุคคลก่อนเริ่มใช้งาน อ่านเพิ่มเติมได้ที่นี่