Mostrando entradas con la etiqueta Estructura repetitiva "Para". Mostrar todas las entradas
Mostrando entradas con la etiqueta Estructura repetitiva "Para". Mostrar todas las entradas

Figura - XIX




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 Figura_XIX_Forms
{
    public partial class Form1 : Form
    {
        public Form1()
        {
            InitializeComponent();
        }

        int numero;

        private void button2_Click(object sender, EventArgs e)
        {
            Application.Exit();
        }

        private void textBox2_TextChanged(object sender, EventArgs e)
        {
            numero = int.Parse(textBox2.Text);
        }

        private void button1_Click(object sender, EventArgs e)
        {
            for (int i = 1; i <= numero; i++)
            {
                for (int j = i; j <= numero; j++)
                {
                    textBox1.Text += "   ";

Asteriscos - VIII




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 Asteriscos_VIII
{
    public partial class Form1 : Form
    {
        public Form1()
        {
            InitializeComponent();
        }

        int n;
        private void button1_Click(object sender, EventArgs e)
        {
            Application.Exit();
        }

        private void textBox2_TextChanged(object sender, EventArgs e)
        {
            n = int.Parse(textBox2.Text);
        }

        private void button2_Click(object sender, EventArgs e)
        {
            for (int r = 1; r <= 10; r++, n--)
            {
                for (int c = 1; c <= n; c++)
                {
                    textBox1.Text += " C";
                }
                for (int c = 1; c <= r; c++)
                {
                    if (c == 1)
                    {
                        textBox1.Text += " *";
                    }
                    else
                    {
                        textBox1.Text += " C";
                    }
                }

Asteriscos - IX



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 Asteriscos_IX
{
    public partial class Form1 : Form
    {
        public Form1()
        {
            InitializeComponent();
        }
        int numero;
        private void button1_Click(object sender, EventArgs e)
        {
            Application.Exit();
        }

        private void textBox2_TextChanged(object sender, EventArgs e)
        {
            numero = int.Parse(textBox2.Text);
        }

        private void button2_Click(object sender, EventArgs e)
        {
            for (int r = 1; r <= numero; r++)
            {
                for (int c = 1; c <= numero; c++)
                {
                    if ((c == 1 && r == 1) || (c == 2 && r == 2) || (c == 3 && r == 3) || (c == 4 && r == 4) || (c == 5 && r == 5) ||
                        (c == 6 && r == 6) || (c == 7 && r == 7) || (c == 8 && r == 8) || (c == 9 && r == 9) || (c == 10 && r == 10))

Asteriscos - VII



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 Asteriscos_VII
{
    public partial class Form1 : Form
    {
        public Form1()
        {
            InitializeComponent();
        }
        int numero;

        private void button2_Click(object sender, EventArgs e)
        {
            Application.Exit();
        }

        private void textBox2_TextChanged(object sender, EventArgs e)
        {
            numero = int.Parse(textBox2.Text);
        }

        private void button1_Click(object sender, EventArgs e)
        {
            for (int r = 1; r <= numero; r++)
            {
                if (r % 2 == 0)
                {
                    textBox1.Text += "*";
                }
                else
                    if (r % 3 == 0)
                {
                    for (int c = 1; c <= r; c++)
                    {
                        textBox1.Text += "*";
                    }
                }
                else

Asteriscos - VI



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 Asteriscos_VI
{
    public partial class Form1 : Form
    {
        public Form1()
        {
            InitializeComponent();
        }

        int numero, r = 1;

        private void button2_Click(object sender, EventArgs e)
        {
            Application.Exit();
        }

        private void button1_Click(object sender, EventArgs e)
        {
            for (; numero >= 1; numero--, r++)
            {
                for (int c = 1; c <= numero; c++)
                {
                    textBox1.Text += "*";
                }
                for (int sp = r; sp > 1; sp--)
                {
                    textBox1.Text += " ";
                }
                for (int sp = r; sp > 1; sp--)
                {
                    textBox1.Text += " ";
                }

Asteriscos - V




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 Asteriscos_V
{
    public partial class Form1 : Form
    {
        public Form1()
        {
            InitializeComponent();
        }

        int numero;

        private void button2_Click(object sender, EventArgs e)
        {
            Application.Exit();
        }

        private void textBox2_TextChanged(object sender, EventArgs e)
        {
            numero = int.Parse(textBox2.Text);
        }

        private void button1_Click(object sender, EventArgs e)
        {
            textBox1.Text += "*" + "\r\n";

            for (int r = 1; r <= numero; r++)
            {
                textBox1.Text += "*";

                for (int sp = 1; sp < r; sp++)
                {
                    textBox1.Text += " ";
                }
                textBox1.Text += "*" + "\r\n";

Asteriscos - IV



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 Asteriscos_IV
{
    public partial class Form1 : Form
    {
        public Form1()
        {
            InitializeComponent();
        }

        int numero, n;
        private void button2_Click(object sender, EventArgs e)
        {
            Application.Exit();
        }

        private void button1_Click(object sender, EventArgs e)
        {
            n = numero;
            for (int r = 1; r <= numero; r++)
            {
                for (int sp = 1; sp <= r; sp++)
                {
                    textBox1.Text += " ";
                }
                for (int c = 1; c <= n; c++)
                {
                    textBox1.Text += "*";
                }
                for (int c = numero - r; c >= 1; c--)
                {
                    textBox1.Text += " *";
                }
                n--;
                textBox1.Text += "\r\n";
            }

Asteriscos - II




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 Asteriscos_II
{
    public partial class Form1 : Form
    {
        public Form1()
        {
            InitializeComponent();
        }

        private void button2_Click(object sender, EventArgs e)
        {
            Application.Exit();
        }

        string entrada;

        private void button1_Click(object sender, EventArgs e)
        {
            for (int i = 0; i < entrada.Length; i++)
            {
                for (int j = 0; j < i + 1; j++)
                {
                    textBox1.Text += (entrada[j]);
                }
                textBox1.Text += "\r\n";
            }
        }

Asteriscos - III





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 Asteriscos_III
{
    public partial class Form1 : Form
    {
        public Form1()
        {
            InitializeComponent();
        }
        int numero, espacio;

        private void button2_Click(object sender, EventArgs e)
        {
            Application.Exit();
        }

        private void textBox2_TextChanged(object sender, EventArgs e)
        {
            numero = int.Parse(textBox2.Text);
        }

        private void button1_Click(object sender, EventArgs e)
        {              
                espacio = numero - 1;

                for (int i = 1; i <= numero; i++)
                {
                    for (espacio = 1; espacio <= (numero - i); espacio++)
                    {
                        textBox1.Text += "   ";
                    }
                    for (int j = 1; j <= i; j++)
                    {
                        textBox1.Text += "  *";
                    }

Asteriscos - I





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 Asteriscos_I
{
    public partial class Form1 : Form
    {
        public Form1()
        {
            InitializeComponent();
        }

        private void button2_Click(object sender, EventArgs e)
        {
            Application.Exit();
        }

        int numerodelineas;

        private void button1_Click(object sender, EventArgs e)
        {

            int contar = 1;

            for (int lineas = numerodelineas; lineas >= 1; lineas--)
            {

                for (int espacios = lineas; espacios >= 0; espacios--)
                {
                    textBox1.Text += "  ";
                }
                for (int asterisco = 1; asterisco <= contar; asterisco++)
                {
                    textBox1.Text += "   *";
                }
                contar++;
                textBox1.Text += "\r\n";
            }

Figura - XVIII



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 Triangulo_XIX_Forms
{
    public partial class Form1 : Form
    {
        public Form1()
        {
            InitializeComponent();
        }

        int n = 1;
        char r, c, ch;

        private void textBox2_TextChanged(object sender, EventArgs e)
        {
            ch = Convert.ToChar(textBox2.Text);
        }

        private void button2_Click(object sender, EventArgs e)
        {
            Application.Exit();
        }

Figura - XVII



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 Triangulo_XVIII_Forms
{
    public partial class Form1 : Form
    {
        public Form1()
        {
            InitializeComponent();
        }
        char ch, r, c, p, z;

        private void button2_Click(object sender, EventArgs e)
        {
            Application.Exit();
        }

        private void textBox2_TextChanged(object sender, EventArgs e)
        {
            ch = Convert.ToChar(textBox2.Text);
        }

        private void button1_Click(object sender, EventArgs e)
        {
            if (ch >= 'a' && ch <= 'z')
            {
                ch = (char)(ch - 32);
            }
            textBox1.Text += "\r\n";

            for (r = 'A', z = ch; r <= ch; r++, z--)
            {
                for (c = r, p = z; c >= 'A'; c--, p++)
                {
                    textBox1.Text += (p.ToString());
                }
                for (c = r, p = (char)(ch - 1); c > 'A'; c--, p--)
                {
                    textBox1.Text += (p.ToString());
                }
                textBox1.Text += "\r\n";
            }

Figura - XIV



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 Triangulo_XV_Forms
{
    public partial class Form1 : Form
    {
        public Form1()
        {
            InitializeComponent();
        }

        int num;

        private void button2_Click(object sender, EventArgs e)
        {
            Application.Exit();
        }

        private void button1_Click(object sender, EventArgs e)
        {
            for (int r = 1; r <= num; r++)
            {
                for (int sp = num - r; sp >= 1; sp--)
                {
                    textBox1.Text += " ";
                }
                textBox1.Text += (r.ToString());
                for (int sp = r * 2; sp > 1; sp--)
                {
                    textBox1.Text += " ";
                }
                textBox1.Text += (r.ToString());
                textBox1.Text += "\r\n";

Figura - XIII




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 Triangulo_XIV_Forms
{
    public partial class Form1 : Form
    {
        public Form1()
        {
            InitializeComponent();
        }

        private void button2_Click(object sender, EventArgs e)
        {
            Application.Exit();
        }
        int num, z = 1, p, n;
        private void button1_Click(object sender, EventArgs e)
        {
            for (int r = 1; r <= num; r++, z = z + 2)
            {
                for (int c = 1; c <= z; c++)
                {
                    if (c % 2 == 0)
                    {
                        textBox1.Text += "*";
                    }
                    else
                    {
                        textBox1.Text += (r.ToString());
                    }
                }
                textBox1.Text += "\r\n";
            }

Figura - XII



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 Triangulo_XIII_Forms
{
    public partial class Form1 : Form
    {
        public Form1()
        {
            InitializeComponent();
        }

        private void button2_Click(object sender, EventArgs e)
        {
            Application.Exit();
        }

        private void button1_Click(object sender, EventArgs e)
        {
            textBox1.Text += "1" + "\r\n";
            for (int r = 2; r <= 20; r++)
            {
                for (int c = 1; c <= r; c++)
                {
                    if (c == r)
                    {
                        textBox1.Text += (r.ToString());
                    }

Figura - XI




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 Triangulo_XII_Forms
{
    public partial class Form1 : Form
    {
        public Form1()
        {
            InitializeComponent();
        }

        int num = 4, q = 6;

        private void button2_Click(object sender, EventArgs e)
        {
            Application.Exit();
        }

        private void button1_Click(object sender, EventArgs e)
        {
         
            for (int r = 1; r <= num; r++, q = q - 2)
            {
                for (int c = 1; c <= r; c++)
                {
                    textBox1.Text += (c.ToString());
                }
                for (int p = q; p >= 1; p--)
                {
                    textBox1.Text += (r.ToString());
                }
                for (int c = r - 1; c >= 1; c--)
                {
                    textBox1.Text += (c.ToString());
                }
                textBox1.Text += "\r\n";

Figura - X



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 Triangulo_XI_Forms
{
    public partial class Form1 : Form
    {
        public Form1()
        {
            InitializeComponent();
        }

        private void button2_Click(object sender, EventArgs e)
        {
            Application.Exit();
        }
        int num, y;

        private void textBox2_TextChanged(object sender, EventArgs e)
        {
            num = int.Parse(textBox2.Text);
        }

        private void button1_Click(object sender, EventArgs e)
        {
            y = num + 1;

            for (int r = 1; r <= num; r++, y--)
            {
                for (int c = 1, n = num; c <= r; c++, n--)
                {
                    textBox1.Text += ("  " + n.ToString());
                }
                for (int c = 1, p = y; c < r; c++, p++)
                {
                    textBox1.Text += ("  " + p.ToString());
                }
                textBox1.Text += "\r\n";

Figura - IX




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 Triangulo_X_Forms
{
    public partial class Form1 : Form
    {
        public Form1()
        {
            InitializeComponent();
        }
        int num, n;
        private void button2_Click(object sender, EventArgs e)
        {
            Application.Exit();
        }

        private void textBox2_TextChanged(object sender, EventArgs e)
        {
            num = int.Parse(textBox2.Text);
        }

        private void button1_Click(object sender, EventArgs e)
        {
            n = num;
            for (int r = 1; r <= num; r++, n--)
            {
                for (int c = n; c <= num; c++)
                {
                    textBox1.Text += (c.ToString());
                }
                for (int c = r, j = num + 1; c > 1; c--, j++)
                {
                    textBox1.Text += (j.ToString());
                }
                textBox1.Text += "\r\n";
            }

Figura - VIII



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 Triangulo_IX_Forms
{
    public partial class Form1 : Form
    {
        public Form1()
        {
            InitializeComponent();
        }

        private void button2_Click(object sender, EventArgs e)
        {
            Application.Exit();
        }

        private void button1_Click(object sender, EventArgs e)
        {
            for (int r = 1, n = 1; r <= 12; r++, n = n + 2)
            {
                if (r % 2 == 0)
                {
                    for (int c = 1, p = 2; c <= n; c++, p = p + 2)
                    {
                        textBox1.Text += ("  " + p.ToString());
                    }
                }

Figura - VII




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 Triangulo_VIII_Forms
{
    public partial class Form1 : Form
    {
        public Form1()
        {
            InitializeComponent();
        }

        private void button2_Click(object sender, EventArgs e)
        {
            Application.Exit();
        }

        private void button1_Click(object sender, EventArgs e)
        {
            int n = 4, p = 4, x = 1;
            for (int r = 1; r <= n; r++)
            {
                for (int c = 1; c <= r; c++, x++)
                {
                    textBox1.Text += (" " + x.ToString());
                }
                textBox1.Text += "\r\n";
            }