0% found this document useful (0 votes)
17 views2 pages

Int Op

The document describes a menu driven program that performs basic math operations like addition, subtraction, multiplication and division based on user input. The program uses a switch statement to determine which operation to perform in a for loop, printing the operation and result for values from 0 to the input value.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
17 views2 pages

Int Op

The document describes a menu driven program that performs basic math operations like addition, subtraction, multiplication and division based on user input. The program uses a switch statement to determine which operation to perform in a for loop, printing the operation and result for values from 0 to the input value.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 2

int op;

float n, valor;

string stgr;
do
{
Console.WriteLine("Menu de operaciones basicas");
Console.WriteLine("1.- ----Suma----<+> ");
Console.WriteLine("2.- Resta----<-> ");
Console.WriteLine("3.- ----Multiplicacion<*> ");
Console.WriteLine("4.- Division----</> ");
Console.Write("Eliga el numero de la operacion a realizar: ");
op = Convert.ToInt32(Console.ReadLine());
Console.Write("Introduzca el primer digito: ");
n = Int32.Parse(Console.ReadLine());
Console.Write("Ingrese otro digito:");
valor = Int32.Parse(Console.ReadLine());

switch (op)
{

case 1:

for (int i = 0; i <= valor; i++)

Console.WriteLine("---------------------------");

Console.WriteLine(n + "+" + i + "=" + (i + n));

}
break;

case 2:

for (int i = 0; i <= valor; i++)

Console.WriteLine("---------------------------");
Console.WriteLine(n + "-" + i + "=" + (n - i));

}
break;

case 3:
for (int i = 0; i <= valor; i++)

Console.WriteLine("---------------------------");

Console.WriteLine(n + "*" + i + "=" + (i * n));

}
break;

case 4:

for (int i = 1; i <= valor; i++)

Console.WriteLine("---------------------------");

Console.WriteLine(n + "/" + i + "=" + (n / i));

}
break;

default:
break;

Console.WriteLine(" ");
Console.WriteLine(" ");
Console.WriteLine("¿Desea repetir? si/no");
stgr = (Console.ReadLine());
} while (stgr == "si");

You might also like