Пример #1
0
        public void isiArrayCopy3()
        {
            int x = 0;

            int[] lipat3 = Deret.lipat3(kelipatan * kelipatan);


            for (int cetak = 1; cetak <= n2; cetak++)
            {
                int j = 0;
                for (int p = 0; p < baris; p++)
                {
                    for (int q = 0; q < kolom; q++)
                    {
                        if (p - q == 0 || q == 0 || (p == baris - 1 && q <= totKolom - 1))
                        {
                            array[p, q + x] = lipat3[j].ToString();
                            j++;
                        }
                    }
                }
                x = x + totKolom;
            }
            cetakArray();
        }
Пример #2
0
        public void Hasil07e()
        {
            int[] der = Deret.deret1(n * n);
            int   pin = 0;

            for (int bangun = 1; bangun <= p; bangun++)
            {
                int angka = 0;
                for (int sd = 0; sd < n; sd++)
                {
                    for (int vn = 0; vn < pSegitiga; vn++)
                    {
                        if (vn + sd >= pSegitiga / 2 && vn - sd <= pSegitiga / 2)
                        {
                            if (bangun % 2 == 1)
                            {
                                array[sd, vn + pin] = der[angka].ToString();
                                angka++;
                            }
                            else
                            {
                                array[n - 1 - sd, vn + pin] = der[angka].ToString();
                                angka++;
                            }
                        }
                    }
                }
                pin += pSegitiga;
            }
            CetakData();
        }
Пример #3
0
        public void Hasil07()
        {
            int[] der1  = Deret.deret1(n * n);
            int   geser = 0;

            for (int bangun = 1; bangun <= p; bangun++)
            {
                int angka = 0;
                for (int i = 0; i < n; i++)
                {
                    for (int j = 0; j < pSegitiga; j++)
                    {
                        if (j + i >= pSegitiga / 2 && j - i <= pSegitiga / 2)
                        {
                            if (bangun % 2 == 1)
                            {
                                array[i, j + geser] = der1[angka].ToString();
                                angka++;
                            }
                            else
                            {
                                array[n - 1 - i, j + geser] = der1[angka].ToString();
                                angka++;
                            }
                        }
                    }
                }
                geser += pSegitiga;
            }
            CetakData();
        }
Пример #4
0
        public void Hasil07c()
        {
            int[] deret = Deret.deret1(n * n);
            int   pind  = 0;

            for (int bangun = 1; bangun <= p; bangun++)
            {
                int angka = 0;
                for (int qw = 0; qw < n; qw++)
                {
                    for (int mm = 0; mm < pSegitiga; mm++)
                    {
                        if (mm + qw >= pSegitiga / 2 && mm - qw <= pSegitiga / 2)
                        {
                            if (bangun % 2 == 1)
                            {
                                array[qw, mm + pind] = deret[angka].ToString();
                                angka++;
                            }
                            else
                            {
                                array[n - 1 - qw, mm + pind] = deret[angka].ToString();
                                angka++;
                            }
                        }
                    }
                }
                pind += pSegitiga;
            }
            CetakData();
        }
Пример #5
0
        public void Hasil07d()
        {
            int[] deret  = Deret.deret1(n * n);
            int   pindah = 0;

            for (int bangun = 1; bangun <= p; bangun++)
            {
                int angka = 0;
                for (int cc = 0; cc < n; cc++)
                {
                    for (int ed = 0; ed < pSegitiga; ed++)
                    {
                        if (ed + cc >= pSegitiga / 2 && ed - cc <= pSegitiga / 2)
                        {
                            if (bangun % 2 == 1)
                            {
                                array[cc, ed + pindah] = deret[angka].ToString();
                                angka++;
                            }
                            else
                            {
                                array[n - 1 - cc, ed + pindah] = deret[angka].ToString();
                                angka++;
                            }
                        }
                    }
                }
                pindah += pSegitiga;
            }
            CetakData();
        }
Пример #6
0
        public void isiArrayCopy2()
        {
            int g = 0;
            int k = 3;

            int[] lipat3 = Deret.lipat3(k * k);

            for (int d = 0; d < n2; d++)
            {
                int index = 0;
                for (int a = 0; a < baris; a++)
                {
                    for (int b = 0; b < kolom; b++)
                    {
                        if (a + b >= baris - 1 && b - a <= baris - 1)
                        {
                            if (d % 2 == 0) // Segitiga normal
                            {
                                array[a, b + g] = lipat3[index].ToString();
                                index++;
                            }
                            else // segtiga kebalik
                            {
                                array[n1 - 1 - a, b + g] = lipat3[index].ToString();
                                index++;
                            }
                        }
                    }
                }
                g = g + totKolom;
            }
            cetakArray();
        }
Пример #7
0
        public void isiArrayCopy1()
        {
            int minggir = 0;
            int l       = 3;

            int[] lipat3 = Deret.lipat3(l * l);

            for (int copy = 0; copy < n2; copy++)
            {
                int i = 0;
                for (int x = 0; x < baris; x++)
                {
                    for (int y = 0; y < kolom; y++)
                    {
                        if (x + y >= baris - 1 && y - x <= baris - 1)
                        {
                            if (copy % 2 == 0) // Segitiga normal
                            {
                                array[x, y + minggir] = lipat3[i].ToString();
                                i++;
                            }
                            else // segtiga kebalik
                            {
                                array[n1 - 1 - x, y + minggir] = lipat3[i].ToString();
                                i++;
                            }
                        }
                    }
                }
                minggir = minggir + totKolom;
            }
            cetakArray();
        }
Пример #8
0
        public void isiArray()
        {
            int geser     = 0;
            int angka     = 1;
            int kelipatan = 3;

            int[] lipat3 = Deret.lipat3(kelipatan * kelipatan);

            for (int bangun = 0; bangun < n2; bangun++)
            {
                int index = 0;
                for (int i = 0; i < baris; i++)
                {
                    for (int j = 0; j < kolom; j++)
                    {
                        if (i + j >= baris - 1 && j - i <= baris - 1)
                        {
                            if (bangun % 2 == 0) // Segitiga normal
                            {
                                array[i, j + geser] = lipat3[index].ToString();
                                index++;
                            }
                            else // segtiga kebalik
                            {
                                array[n1 - 1 - i, j + geser] = lipat3[index].ToString();
                                index++;
                            }
                        }
                    }
                }
                geser = geser + totKolom;
            }
            cetakArray();
        }
Пример #9
0
        public void Hasil07b()
        {
            int[] deret1 = Deret.deret1(n * n);
            int   pindah = 0;

            for (int bangun = 1; bangun <= p; bangun++)
            {
                int angka = 0;
                for (int dc = 0; dc < n; dc++)
                {
                    for (int sw = 0; sw < pSegitiga; sw++)
                    {
                        if (sw + dc >= pSegitiga / 2 && sw - dc <= pSegitiga / 2)
                        {
                            if (bangun % 2 == 1)
                            {
                                array[dc, sw + pindah] = deret1[angka].ToString();
                                angka++;
                            }
                            else
                            {
                                array[n - 1 - dc, sw + pindah] = deret1[angka].ToString();
                                angka++;
                            }
                        }
                    }
                }
                pindah += pSegitiga;
            }
            CetakData();
        }
Пример #10
0
        public void Hasil07a()
        {
            int[] der1  = Deret.deret1(n * n);
            int   geser = 0;

            for (int bangun = 1; bangun <= p; bangun++)
            {
                int angka = 0;
                for (int qq = 0; qq < n; qq++)
                {
                    for (int cd = 0; cd < pSegitiga; cd++)
                    {
                        if (cd + qq >= pSegitiga / 2 && cd - qq <= pSegitiga / 2)
                        {
                            if (bangun % 2 == 1)
                            {
                                array[qq, cd + geser] = der1[angka].ToString();
                                angka++;
                            }
                            else
                            {
                                array[n - 1 - qq, cd + geser] = der1[angka].ToString();
                                angka++;
                            }
                        }
                    }
                }
                geser += pSegitiga;
            }
            CetakData();
        }
Пример #11
0
        public void isiArrayCopy2()
        {
            int minggir = 0;

            int[] lipat3 = Deret.lipat3(kelipatan * kelipatan);


            for (int copy = 1; copy <= n2; copy++)
            {
                int i = 0;
                for (int m = 0; m < baris; m++)
                {
                    for (int n = 0; n < kolom; n++)
                    {
                        if (m - n == 0 || n == 0 || (m == baris - 1 && n <= totKolom - 1))
                        {
                            array[m, n + minggir] = lipat3[i].ToString();
                            i++;
                        }
                    }
                }
                minggir = minggir + totKolom;
            }
            cetakArray();
        }
Пример #12
0
        public void isiArrayCopy2()
        {
            int minggir = 0;

            int[] fibo = Deret.fibo(n1 * n1);


            for (int pindah = 1; pindah <= n2; pindah++)
            {
                int i = 0;
                for (int m = 0; m < baris; m++)
                {
                    for (int n = 0; n < kolom; n++)
                    {
                        if (m + n >= baris - 1 && n - m <= baris - 1) // Sgitiga
                        {
                            array[m, n + minggir] = fibo[i].ToString();
                            i++;
                        }
                    }
                }
                minggir = minggir + totKolom;
            }
            cetakArray();
        }
Пример #13
0
        public void isiArrayCopy2()
        {
            int minggir = 0;

            int[] lipat4 = Deret.lipat4(12);


            for (int cetak = 1; cetak <= n2; cetak++)
            {
                for (int m = 0; m < baris; m++)
                {
                    for (int n = 0; n < kolom; n++)
                    {
                        if (m == 0 && n <= totKolom - 1)
                        {
                            array[m, n + minggir] = "*";
                        }
                        else if (n == totKolom - 1)
                        {
                            array[m, n + minggir] = "*";
                        }
                        else if (n == 0)
                        {
                            array[m, n + minggir] = "*";
                        }
                        else if (m == totKolom - 1 && n <= totKolom - 1)
                        {
                            array[m, n + minggir] = "*";
                        }
                    }
                }
                minggir = minggir + totKolom;
            }
            cetakArray();
        }
Пример #14
0
        public void isiArray()
        {
            int geser = 0;

            int[] lipat3 = Deret.lipat3(kelipatan * kelipatan);


            for (int bangun = 1; bangun <= n2; bangun++)
            {
                int index = 0;
                for (int i = 0; i < baris; i++)
                {
                    for (int j = 0; j < kolom; j++)
                    {
                        if (i - j == 0 || j == 0 || (i == baris - 1 && j <= totKolom - 1))
                        {
                            array[i, j + geser] = lipat3[index].ToString();
                            index++;
                        }
                    }
                }
                geser = geser + totKolom;
            }
            cetakArray();
        }
Пример #15
0
        public void isiArrayCopy3()
        {
            int x = 0;

            int[] fibo = Deret.fibo(n1 * n1);


            for (int pindah = 1; pindah <= n2; pindah++)
            {
                int j = 0;
                for (int p = 0; p < baris; p++)
                {
                    for (int q = 0; q < kolom; q++)
                    {
                        if (p + q >= baris - 1 && q - p <= baris - 1) // Sgitiga
                        {
                            array[p, q + x] = fibo[j].ToString();
                            j++;
                        }
                    }
                }
                x = x + totKolom;
            }
            cetakArray();
        }
Пример #16
0
        public void isiArrayCopy4()
        {
            int z = 0;

            int[] lipat3 = Deret.lipat3(kelipatan * kelipatan);


            for (int segtiga = 1; segtiga <= n2; segtiga++)
            {
                int a = 0;
                for (int x = 0; x < baris; x++)
                {
                    for (int y = 0; y < kolom; y++)
                    {
                        if (x - y == 0 || y == 0 || (x == baris - 1 && y <= totKolom - 1))
                        {
                            array[x, y + z] = lipat3[a].ToString();
                            a++;
                        }
                    }
                }
                z = z + totKolom;
            }
            cetakArray();
        }
Пример #17
0
        public void isiArray() // deret angka
        {
            int geser = 0;

            //int psegitiga = (2 * n1) - 1; // total kolom dalam satu segitiga
            int[] fibo = Deret.fibo(n1 * n1);


            for (int bangun = 1; bangun <= n2; bangun++)
            {
                //int angka = 1;
                int index = 0;
                for (int i = 0; i < baris; i++)
                {
                    for (int j = 0; j < kolom; j++)
                    {
                        if (i + j >= baris - 1 && j - i <= baris - 1) // Sgitiga
                        {
                            array[i, j + geser] = fibo[index].ToString();
                            index++;
                        }
                    }
                }
                geser = geser + totKolom;
            }
            cetakArray();
        }
Пример #18
0
        public void isiArrayCopy4()
        {
            int z = 0;

            int[] fibo = Deret.fibo(n1 * n1);


            for (int ganti = 1; ganti <= n2; ganti++)
            {
                int k = 0;
                for (int x = 0; x < baris; x++)
                {
                    for (int y = 0; y < kolom; y++)
                    {
                        if (x + y >= baris - 1 && y - x <= baris - 1) // Sgitiga
                        {
                            array[x, y + z] = fibo[k].ToString();
                            k++;
                        }
                    }
                }
                z = z + totKolom;
            }
            cetakArray();
        }
Пример #19
0
        public void Hasil10()
        {
            int geser = 0;

            int[] deret = Deret.deret1(27);
            for (int bangun = 1; bangun <= p; bangun++)
            {
                int angka = 0;
                for (int i = 0; i < n; i++)
                {
                    for (int j = 0; j < n; j++)
                    {
                        if (i == 0)
                        {
                            array[i, j + geser] = deret[angka].ToString();
                            angka++;
                            if (j >= n)
                            {
                                break;
                            }
                        }
                        if (j == n - 1)
                        {
                            array[i, j + geser] = deret[angka].ToString();
                            angka++;
                            if (i >= n)
                            {
                                break;
                            }
                        }
                        if (i == n - 1)
                        {
                            array[i, (n - 1 - j) + geser] = deret[angka].ToString();
                            angka++;
                            if (j >= n)
                            {
                                break;
                            }
                        }
                        if (j == 0)
                        {
                            array[n - 1 - i, j + geser] = deret[angka].ToString();
                            angka++;
                        }
                    }
                }
                geser += pSegitiga;
            }
            CetakData();
        }
Пример #20
0
        public void isiArray()
        {
            int geser = 0;

            int[] lipat3 = Deret.lipat3(n1 * kelipatan);

            for (int bangun = 0; bangun < n2; bangun++)
            {
                int index = 0;
                for (int i = 0; i < baris; i++)
                {
                    for (int j = 0; j < n1; j++)
                    {
                        if (i == 0 && j <= 3)
                        {
                            //array[i, j+geser] = "*" + lipat3[index].ToString(); index++;
                            array[i, j + geser] = lipat3[index].ToString(); index++;
                            //array[i, j] = index.ToString(); index++;
                        }
                        else if (j == 3 && i <= baris - 1)
                        {
                            //array[i, j + geser] = "#" + lipat3[index].ToString(); index++;
                            array[i, j + geser] = lipat3[index].ToString(); index++;
                            //array[i, j] = index.ToString(); index++;
                        }
                        else if (i == baris - 1 && j <= 3)
                        {
                            //array[i, j + geser] = "@" + lipat3[index].ToString(); index++;
                            array[i, j + geser] = lipat3[index].ToString(); index++;
                            //array[i, j] = index.ToString(); index++;
                        }
                        else if (j == 0 && i <= baris - 1)
                        {
                            //array[i, j + geser] = "%" + lipat3[index].ToString(); index++;
                            array[i, j + geser] = lipat3[index].ToString(); index++;
                            //array[i, j] = index.ToString(); index++;
                        }
                    }
                }
                geser = geser + totKolom;
            }
            cetakArray();
        }
Пример #21
0
        public void Hasil08()
        {
            int[] deret2 = Deret.deret1(n * n);
            int   geser  = 0;

            for (int bangun = 1; bangun <= p; bangun++)
            {
                int angka = 0;
                for (int i = 0; i < n; i++)
                {
                    for (int j = 0; j < n; j++)
                    {
                        if (i == j || j == 0 || i == n - 1)
                        {
                            array[i, j + geser] = deret2[angka].ToString();
                            angka++;
                        }
                    }
                }
                geser += pSegitiga;
            }
            CetakData();
        }
Пример #22
0
        public void Hasil06c()
        {
            int gsr = 0;

            int[] fibon = Deret.fibo(n * n);
            for (int bangun = 1; bangun <= p; bangun++)
            {
                int angka = 0;
                for (int cf = 0; cf < baris; cf++)
                {
                    for (int lm = 0; lm < kolom; lm++)
                    {
                        if (lm + cf >= n - 1 && lm - cf <= n - 1)
                        {
                            array[cf, lm + gsr] = fibon[angka].ToString();
                            angka++;
                        }
                    }
                }
                gsr += pSegitiga;
            }

            CetakData();
        }
Пример #23
0
        public void Hasil06b()
        {
            int pindah = 0;

            int[] fibon = Deret.fibo(n * n);
            for (int bangun = 1; bangun <= p; bangun++)
            {
                int angka = 0;
                for (int bn = 0; bn < baris; bn++)
                {
                    for (int vb = 0; vb < kolom; vb++)
                    {
                        if (vb + bn >= n - 1 && vb - bn <= n - 1)
                        {
                            array[bn, vb + pindah] = fibon[angka].ToString();
                            angka++;
                        }
                    }
                }
                pindah += pSegitiga;
            }

            CetakData();
        }
Пример #24
0
        public void Hasil06a()
        {
            int geser = 0;

            int[] fibon = Deret.fibo(n * n);
            for (int bangun = 1; bangun <= p; bangun++)
            {
                int angka = 0;
                for (int ef = 0; ef < baris; ef++)
                {
                    for (int sd = 0; sd < kolom; sd++)
                    {
                        if (sd + ef >= n - 1 && sd - ef <= n - 1)
                        {
                            array[ef, sd + geser] = fibon[angka].ToString();
                            angka++;
                        }
                    }
                }
                geser += pSegitiga;
            }

            CetakData();
        }
Пример #25
0
        public void Hasil06()
        {
            int geser = 0;

            int[] fibon = Deret.fibo(n * n);
            for (int bangun = 1; bangun <= p; bangun++)
            {
                int angka = 0;
                for (int i = 0; i < baris; i++)
                {
                    for (int j = 0; j < kolom; j++)
                    {
                        if (j + i >= n - 1 && j - i <= n - 1)
                        {
                            array[i, j + geser] = fibon[angka].ToString();
                            angka++;
                        }
                    }
                }
                geser += pSegitiga;
            }

            CetakData();
        }
Пример #26
0
        public void Hasil06e()
        {
            int geser = 0;

            int[] fibon = Deret.fibo(n * n);
            for (int bent = 1; bent <= p; bent++)
            {
                int angka = 0;
                for (int ws = 0; ws < baris; ws++)
                {
                    for (int dd = 0; dd < kolom; dd++)
                    {
                        if (dd + ws >= n - 1 && dd - ws <= n - 1)
                        {
                            array[ws, dd + geser] = fibon[angka].ToString();
                            angka++;
                        }
                    }
                }
                geser += pSegitiga;
            }

            CetakData();
        }
Пример #27
0
        public void Hasil06d()
        {
            int geser = 0;

            int[] fibon = Deret.fibo(n * n);
            for (int bentuk = 1; bentuk <= p; bentuk++)
            {
                int angka = 0;
                for (int dd = 0; dd < baris; dd++)
                {
                    for (int cv = 0; cv < kolom; cv++)
                    {
                        if (cv + dd >= n - 1 && cv - dd <= n - 1)
                        {
                            array[dd, cv + geser] = fibon[angka].ToString();
                            angka++;
                        }
                    }
                }
                geser += pSegitiga;
            }

            CetakData();
        }
Пример #28
0
        public void isiArray() // deret angka
        {
            int geser = 0;

            int[] lipat4 = Deret.lipat4(kelipatan * kelipatan);

            for (int bangun = 1; bangun <= n2; bangun++)
            {
                int index = 0;
                if (bangun % 4 == 1)
                {
                    for (int i = 0; i < n1; i++)
                    {
                        for (int j = 0; j < n1; j++)
                        {
                            if (j == i || j == 0 || i == n1 - 1)
                            {
                                array[i, j + geser] = lipat4[index].ToString();
                                index++;
                            }
                        }
                    }
                }
                else if (bangun % 4 == 2)
                {
                    for (int i = 0; i < n1; i++)
                    {
                        for (int j = 0; j < n1; j++)
                        {
                            if (i + j == n1 - 1 || j == 0 || i == 0)
                            {
                                array[i, j + geser] = lipat4[index].ToString();
                                index++;
                            }
                        }
                    }
                }
                else if (bangun % 4 == 3)
                {
                    for (int i = 0; i < n1; i++)
                    {
                        for (int j = 0; j < n1; j++)
                        {
                            if (j == i || i == 0 || j == n1 - 1)
                            {
                                array[i, j + geser] = lipat4[index].ToString();
                                index++;
                            }
                        }
                    }
                }
                else if (bangun % 4 == 0)
                {
                    for (int i = 0; i < n1; i++)
                    {
                        for (int j = 0; j < n1; j++)
                        {
                            if (j + i == n1 - 1 || j == n1 - 1 || i == n1 - 1)
                            {
                                array[i, j + geser] = lipat4[index].ToString();
                                index++;
                            }
                        }
                    }
                }

                geser = geser + totKolom;
            }

            cetakArray();
        }
Пример #29
0
        public void Hasil09()
        {
            int geser = 0;

            int[] deret = Deret.deret2(n * n);

            for (int bang = 1; bang <= p; bang++)
            {
                int angka = 0;

                if (bang % 4 == 1)
                {
                    for (int i = 0; i < n; i++)
                    {
                        for (int j = 0; j < n; j++)
                        {
                            if (j == i || j == 0 || i == n - 1)
                            {
                                array[i, j + geser] = deret[angka].ToString();
                                angka++;
                            }
                        }
                    }
                }
                else if (bang % 4 == 2)
                {
                    for (int i = 0; i < n; i++)
                    {
                        for (int j = 0; j < n; j++)
                        {
                            if (j + i == n - 1 || j == 0 || i == 0)
                            {
                                array[i, j + geser] = deret[angka].ToString();
                                angka++;
                            }
                        }
                    }
                }

                else if (bang % 4 == 3)
                {
                    for (int i = 0; i < n; i++)
                    {
                        for (int j = 0; j < n; j++)
                        {
                            if (j == i || j == n - 1 || i == 0)
                            {
                                array[i, j + geser] = deret[angka].ToString();
                                angka++;
                            }
                        }
                    }
                }
                else
                {
                    for (int i = 0; i < n; i++)
                    {
                        for (int j = 0; j < n; j++)
                        {
                            if (j + i == n - 1 || j == n - 1 || i == n - 1)
                            {
                                array[i, j + geser] = deret[angka].ToString();
                                angka++;
                            }
                        }
                    }
                }
                geser += pSegitiga;
            }
            CetakData();
        }