Suma de dos números C# (Forms)
Programa que realice la suma de dos números enteros en forms.
Código:
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 estrcturabasica
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}
private void btnsuma_Click(object sender, EventArgs e)
{
int num1, num2, res;
num1 = Int32.Parse(txtnum1.Text);
num2 = Int32.Parse(txtnum2.Text);
res = num1 + num2;
txtsuma.Text = res.ToString();
}
private void btnsalida_Click(object sender, EventArgs e)
{
Close();
}
}
}
Código:
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 estrcturabasica
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}
private void btnsuma_Click(object sender, EventArgs e)
{
int num1, num2, res;
num1 = Int32.Parse(txtnum1.Text);
num2 = Int32.Parse(txtnum2.Text);
res = num1 + num2;
txtsuma.Text = res.ToString();
}
private void btnsalida_Click(object sender, EventArgs e)
{
Close();
}
}
}
Pantalla:
Comentarios
Publicar un comentario