using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;

namespace _6주차_구구단만들기_김인태_
{
    public partial class Final : Form
    {
        public Final()
        {
            InitializeComponent();
        }

        private void button1_Click(object sender, EventArgs e)
        {

            textBox1.Text = "";
            for(int i = 1;  i < 10; i++)
            {
                for(int j = 1; j < 10; j++)
                {
                    textBox1.Text += i + " X " + j + " = " + (i * j) + Environment.NewLine;
                }
                textBox1.Text += Environment.NewLine;
            }
        }

        private void button2_Click(object sender, EventArgs e)
        {
            int i = 1, j = 1;

            textBox1.Text = "";
            while (i < 10) {
                while (j < 10)
                {
                    textBox1.Text += i + " X " + j + " = " + (i * j) + Environment.NewLine;
                    j++;
                }
                textBox1.Text += Environment.NewLine;
                j = 1;
                i++;
            }
        }

        private void button3_Click(object sender, EventArgs e)
        {
            int i = 1, j = 1;

            textBox1.Text = "";
            do
            {
                do
                {
                    textBox1.Text += i + " X " + j + " = " + (i * j) + Environment.NewLine;
                    j++;
                } while (j < 10);
                textBox1.Text += Environment.NewLine;
                j = 1;
                i++;
            } while (i < 10);
        }

        private void button4_Click(object sender, EventArgs e)
        {
            int i = 1, j = 1;
            textBox1.Text = "";

            while (true)
            {
                while (true)
                {
                    textBox1.Text += i + " X " + j + " = " + (i * j) + Environment.NewLine;
                    j++;
                    if (j > 9)
                        break;
                }
                j = 1;
                i++;
                textBox1.Text += Environment.NewLine;

                if (i > 9)
                    break;
            }
        }

        private void button5_Click(object sender, EventArgs e)
        {
            int[] arr = { 1, 2, 3, 4, 5, 6, 7, 8, 9 };
            textBox1.Text += "";

            foreach (int i in arr)
            {
                foreach(int j in arr)
                {
                    textBox1.Text += i + " X " + j + " = " + (i * j) + Environment.NewLine;
                }
                textBox1.Text += Environment.NewLine;
            }
        }

        private void button10_Click(object sender, EventArgs e)
        {
            textBox1.Text = "";
            for(int i = 1; i < 10; i+= 3)
            {
                for(int j = 1; j < 10; j++)
                {
                    for(int k = 0; k < 3; k++)
                    {
                        textBox1.Text += (i + k) + " X " + j + " = " + (i + k) * j + "\\t\\t";
                    }
                    textBox1.Text += Environment.NewLine;
                }
                textBox1.Text += Environment.NewLine;
            }
        }

        private void button9_Click(object sender, EventArgs e)
        {
            int i = 1, j = 1, k = 0;

            textBox1.Text = "";
            while(i < 10)
            {
                while(j < 10)
                {
                    while (k < 3)
                    {
                        textBox1.Text += (i + k) + " X " + j + " = " + (i + k) * j + "\\t\\t";
                        k++;
                    }
                    k = 0;
                    j++;
                    textBox1.Text += Environment.NewLine;
                }
                j = 1;
                i+= 3;
                textBox1.Text += Environment.NewLine;
            }
        }

        private void button8_Click(object sender, EventArgs e)
        {
            int i = 1, j = 1, k = 0;

            textBox1.Text = "";
            do
            {
                do
                {
                    do
                    {
                        textBox1.Text += (i + k) + " X " + j + " = " + (i + k) * j + "\\t\\t";
                        k++;
                    } while (k < 3);
                    textBox1.Text += Environment.NewLine;
                    k = 0;
                    j++;
                } while (j < 10);
                textBox1.Text += Environment.NewLine;
                j = 1;
                i += 3;
            } while (i < 10);
        }

        private void button7_Click(object sender, EventArgs e)
        {
            int i = 1, j = 1, k = 0;

            textBox1.Text = "";
            while (true)
            {
                while (true)
                {
                    while (true)
                    {
                        textBox1.Text += (i + k) + " X " + j + " = " + (i + k) * j + "\\t\\t";
                        k++;
                        if (k > 2)
                            break;
                    }
                    textBox1.Text += Environment.NewLine;
                    k = 0;
                    j++;
                    if (j > 9)
                        break;
                }
                textBox1.Text += Environment.NewLine;
                j = 1;
                i += 3;
                if (i > 9)
                    break;
            }
        }

        private void button6_Click(object sender, EventArgs e)
        {
            int[] arr1 = { 1, 4, 7 };
            int[] arr2 = { 1, 2, 3, 4, 5, 6, 7, 8, 9 };
            int[] arr3 = { 0, 1, 2 };

            textBox1.Text = "";
            foreach(int i in arr1)
            {
                foreach(int j in arr2)
                {
                    foreach(int k in arr3)
                    {
                        textBox1.Text += (i + k) + " X " + j + " = " + (i + k) * j + "\\t\\t";
                    }
                    textBox1.Text += Environment.NewLine;
                }
                textBox1.Text += Environment.NewLine;
            }
        }

        private void button20_Click(object sender, EventArgs e)
        {
            textBox1.Text = "";

            for(int i=7; i > 0; i-= 3)
            {
                for(int j=1; j< 10; j++)
                {
                    for(int k = 2; k>=0; k--)
                    {
                        textBox1.Text += (i + k) + " X " + j + " = " + (i + k) * j + "\\t\\t";
                    }
                    textBox1.Text += Environment.NewLine;
                }
                textBox1.Text += Environment.NewLine;
            }
        }

        private void button19_Click(object sender, EventArgs e)
        {
            int i = 7, j = 1, k = 2;
            textBox1.Text = "";
            while(i >= 0)
            {
                while(j < 10)
                {
                    while(k >= 0)
                    {
                        textBox1.Text += (i + k) + " X " + j + " = " + (i + k) * j + "\\t\\t";
                        k--;
                    }
                    textBox1.Text += Environment.NewLine;
                    k = 2;
                    j++;
                }
                textBox1.Text += Environment.NewLine;
                j = 1;
                i -= 3;
            }
        }

        private void button18_Click(object sender, EventArgs e)
        {
            int i = 7, j = 1, k = 2;

            textBox1.Text = "";
            do
            {
                do
                {
                    do
                    {
                        textBox1.Text += (i + k) + " X " + j + " = " + (i + k) * j + "\\t\\t";
                        k--;
                    } while (k >= 0);
                    textBox1.Text += Environment.NewLine;
                    k = 2;
                    j++;
                } while (j < 10);
                textBox1.Text += Environment.NewLine;
                j = 1;
                i -= 3;
            } while (i >= 0);
        }

        private void button17_Click(object sender, EventArgs e)
        {
            int i = 7, j = 1, k = 2;
            textBox1.Text = "";
            while (true)
            {
                while (true)
                {
                    while (true)
                    {
                        textBox1.Text += (i + k) + " X " + j + " = " + (i + k) * j + "\\t\\t";
                        k--;
                        if (k < 0)
                            break;
                    }
                    textBox1.Text += Environment.NewLine;
                    k = 2;
                    j++;
                    if (j > 9)
                        break;
                }
                textBox1.Text += Environment.NewLine;
                j = 1;
                i -= 3;
                if (i <= 0)
                    break;
            }
        }

        private void button16_Click(object sender, EventArgs e)
        {
            int[] arr1 = { 7, 4, 1 };
            int[] arr2 = { 1, 2, 3, 4, 5, 6, 7, 8, 9 };
            int[] arr3 = { 2, 1, 0 };

            textBox1.Text = "";
            foreach(int i in arr1)
            {
                foreach(int j in arr2)
                {
                    foreach(int k in arr3)
                    {
                        textBox1.Text += (i + k) + " X " + j + " = " + (i + k) * j + "\\t\\t";
                    }
                    textBox1.Text += Environment.NewLine;
                }
                textBox1.Text += Environment.NewLine;
            }
        }
    }
}