Resta de 2 números enteros en - C# aplicación

Realizar una aplicación para restar dos números enteros.



CÓDIGO FUENTE

using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;

namespace Resta
{
    public partial class Form1 : Form
    {
        public Form1()
        {
            InitializeComponent();
        }

        private void button1_Click(object sender, EventArgs e)
        {
            int n1 = int.Parse(textBox1.Text);
            int n2 = int.Parse(textBox2.Text);

            int resta = n1 - n2;

            textBox3.Text = resta.ToString();

        }


        private void button2_Click(object sender, EventArgs e)
        {
            textBox1.Clear();
            textBox2.Clear();
            textBox3.Clear();
            textBox1.Focus();

        }


        private void button3_Click(object sender, EventArgs e)
        {
            Close();
        }


    }
}

Suma de 2 números C# - Aplicación

Realizar una aplicación para sumar 2 números enteros.


CÓDIGO FUENTE


using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;

namespace Suma
{
    public partial class Form1 : Form
    {
        public Form1()
        {
            InitializeComponent();
        }

        private void button1_Click(object sender, EventArgs e)
        {
            int n1 = int.Parse(textBox1.Text);
            int n2 = int.Parse(textBox2.Text);
            
            int suma = n1 + n2;
            
            textBox3.Text = suma.ToString();

        }


        private void button2_Click(object sender, EventArgs e)
        {
            textBox1.Clear();
            textBox2.Clear();
            textBox3.Clear();
            textBox1.Focus();

        }

        
        private void button3_Click(object sender, EventArgs e)
        {
            Close();   
        }
    }
}


Popular Posts