...poco a poco los impulsos eléctricos comenzaron a llenar la memoria de su cerebro de silicio. Tras un pequeño parpadeo que ilumino sus ojos, cobro vida...
Mostrando entradas con la etiqueta Procedimientos y Funciones. Mostrar todas las entradas
Mostrando entradas con la etiqueta Procedimientos y Funciones. Mostrar todas las entradas
Factorial mediante una Función
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 numero19
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}
private void button2_Click(object sender, EventArgs e)
{
Application.Exit();
}
//Variables
int numero, f, i;
private void textBox1_TextChanged(object sender, EventArgs e)
{
numero = int.Parse(textBox1.Text);
}
//Proceso
private void button1_Click(object sender, EventArgs e)
{
f = Factorial(numero);
textBox2.Text = f.ToString();
}
Par o Impar mediante procedimiento
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 numero18
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}
//Variables
int numero;
string resultado = "";
private void button2_Click(object sender, EventArgs e)
{
Application.Exit();
}
//Entrada
private void textBox1_TextChanged(object sender, EventArgs e)
{
numero = int.Parse(textBox1.Text);
}
//Proceso
Función para eliminar espacios en blanco
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 numero15
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}
//Variables
string textoentrada, textosalida;
private void textBox1_TextChanged(object sender, EventArgs e)
{
textoentrada = textBox1.Text;
}
//Proceso
private void button1_Click(object sender, EventArgs e)
{
textosalida = textosinespacios(textoentrada);
textBox2.Text = textosalida.ToString();
}
Sumar mediante una Función
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 numero13
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}
//Variables
int n1, n2, s;
private void textBox1_TextChanged(object sender, EventArgs e)
{
n1 = int.Parse(textBox1.Text);
}
private void textBox2_TextChanged(object sender, EventArgs e)
{
n2 = int.Parse(textBox2.Text);
}
private void button1_Click(object sender, EventArgs e)
{
//Proceso
s = Sumar(n1, n2);
textBox3.Text = s.ToString();
}
Suscribirse a:
Comentarios (Atom)