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";
}
for (int r = 3, m = 1; r >= 1; r--, m = m + 2)
{
for (int c = 1; c <= r; c++)
{
textBox1.Text += (c.ToString());
}
for (int n = m; n >= 1; n--)
{
textBox1.Text += (r.ToString());
}
for (int c = r; c >= 1; c--)
{
textBox1.Text += (c.ToString());
}
textBox1.Text += "\r\n";
}
}
}
}
No hay comentarios:
Publicar un comentario
Nota: solo los miembros de este blog pueden publicar comentarios.