Suma Matriz Bidimensional 3x2





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

//Variables
int s = 0, i, j;

// Arreglos

int[,] n = new int[3, 2];

//Entrada
private void textBox1_TextChanged(object sender, EventArgs e)
{
n[0, 0] = int.Parse(textBox1.Text);
}

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

private void textBox3_TextChanged(object sender, EventArgs e)
{
n[1, 0] = int.Parse(textBox3.Text);
}

private void textBox4_TextChanged(object sender, EventArgs e)
{
n[1, 1] = int.Parse(textBox4.Text);
}

private void textBox5_TextChanged(object sender, EventArgs e)
{
n[2, 0] = int.Parse(textBox5.Text);
}

private void textBox6_TextChanged(object sender, EventArgs e)
{
n[2, 1] = int.Parse(textBox6.Text);
}




//Proceso y Salida

private void button1_Click(object sender, EventArgs e)
{
for (i = 0; i <= 2; i++)
for (j = 0; j <= 1; j++)
s += n[i, j];

textBox7.Text = s.ToString();
}
private void button2_Click(object sender, EventArgs e)
{
Application.Exit();
}
}
}







No hay comentarios:

Publicar un comentario

Nota: solo los miembros de este blog pueden publicar comentarios.