Algoritmos
Enviado por Lizeth Fernanda Liz • 5 de Junio de 2018 • Apuntes • 4.699 Palabras (19 Páginas) • 536 Visitas
3)
namespace EMPRESACOMERCIAL
{
public partial class Form2 : Form
{
public Form2()
{
InitializeComponent();
}
private void button1_Click(object sender, EventArgs e)
{
int Resto=0 , Cen, Dec, Uni , N ;
N = int.Parse(textBox1.Text);
Cen = Resto / 100;
Resto = Resto % 100;
Dec = Resto / 10;
Resto = Resto % 10;
Uni = Resto;
switch (Cen)
{
case 1: textBox2.Text = ("C"); break;
case 2: textBox2.Text = ("CC"); break;
case 3: textBox2.Text = ("CCC"); break;
case 4: textBox2.Text = ("CD"); break;
case 5: textBox2.Text = ("D"); break;
case 6: textBox2.Text = ("DC"); break;
case 7: textBox2.Text = ("DCC"); break;
case 8: textBox2.Text = ("DCCC"); break;
case 9: textBox2.Text = ("CM"); break;
}
switch (Dec)
{
case 1:
textBox2.Text = ("X");
break;
case 2:
textBox2.Text = ("XX");
break;
case 3:
textBox2.Text = ("XXX");
break;
case 4:
textBox2.Text = ("XL");
break;
case 5:
textBox2.Text = ("L");
break;
case 6:
textBox2.Text = ("LX");
break;
case 7:
textBox2.Text = ("LXX");
break;
case 8:
textBox2.Text = ("LXXX");
break;
case 9:
textBox2.Text = ("XC");
break;
}
switch (Uni)
{
case 1: textBox2.Text = ("I"); break;
case 2: textBox2.Text = ("II"); break;
case 3: textBox2.Text = ("III"); break;
case 4: textBox2.Text = ("IV"); break;
case 5: textBox2.Text = ("V"); break;
case 6: textBox2.Text = ("VI"); break;
case 7: textBox2.Text = ("VII"); break;
case 8: textBox2.Text = ("VIII"); break;
case 9: textBox2.Text = ("IX"); break;
}
textBox2.Text = Convert.ToString(Cen + Dec + Uni);
}
}
}
[pic 1]
4) CODIGO
namespace CONDICIONAL_MULTIPLE
{
public partial class ejercicio4 : Form
...