public static void Main() {
int varAuxiliarGlobal = 0;
Program problema = new Program();
while (varAuxiliarGlobal == 0) {
Console.WriteLine("--- Menu Principal ---");
Console.WriteLine("Opciones ");
Console.WriteLine("1. Problema 1 ");
Console.WriteLine("2. Problema 2 ");
Console.WriteLine("3. Problema 3 ");
Console.WriteLine("4. Salir ");
Console.WriteLine("-----------------------");
Console.WriteLine("Introduce la opcion: ");
opcionEntrada = Console.ReadLine();
if (opcionEntrada == "1") {
if (opcionEntrada == "2") {
if (opcionEntrada == "3") {
if (opcionEntrada == "4") {
Console.WriteLine("Estudiante: ");
Console.WriteLine("* Abner Israel Gomez Morales");
if (opcionEntrada != "1" && opcionEntrada != "2" && opcionEntrada != "3" && opcionEntrada != "4") {
Console.WriteLine("Opcion erronea, introduce una opcion entre 1-4");
public void problema1() {
Console.WriteLine("-----------------------");
Console.WriteLine("1. Problema 1 ");
Console.WriteLine("-----------------------");
int[] valores = new int[5];
String[] nombres = new String[5];
int varAuxiliarlocal = 0;
for (int i = 0; i < 5; i++) {
Console.WriteLine("Ingresa el nombre (" + (i + 1) + "): ");
nombres[i] = Console.ReadLine();
Console.WriteLine("Ingresa la edad: ");
valores[i] = int.Parse(Console.ReadLine());
Console.WriteLine("-----------------------");
while (varAuxiliarlocal == 0) {
Console.WriteLine("--- Menu local ---");
Console.WriteLine("Opciones ");
Console.WriteLine("a. Los nombres y las edades de las personas mayores de edad en Mexico");
Console.WriteLine("b. Los nombres y las edades de las personas mayores de edad en Estados Unidos");
Console.WriteLine("c. Los nombres y las edades de las personas menores de edad en Mexico ");
Console.WriteLine("d. Los nombres y las edades de las personas menores de edad en Estados Unidos ");
Console.WriteLine("e. Salir ");
Console.WriteLine("-----------------------");
Console.WriteLine("Introduce la opcion: ");
String opcionEntradaLocal;
opcionEntradaLocal = Console.ReadLine();
if (opcionEntradaLocal == "a") {
for (int j = 0; j < 5; j++) {
if (valores[j] >= mayorEdad) {
Console.WriteLine("Mayor de edad: " + nombres[j] + ", Edad: " + valores[j]);
if (opcionEntradaLocal == "b") {
for (int j = 0; j < 5; j++) {
if (valores[j] >= mayorEdad) {
Console.WriteLine("Mayor de edad: " + nombres[j] + ", Edad: " + valores[j]);
if (opcionEntradaLocal == "c") {
for (int j = 0; j < 5; j++) {
if (valores[j] <= menorEdad) {
Console.WriteLine("Menor de edad: " + nombres[j] + ", Edad: " + valores[j]);
if (opcionEntradaLocal == "d") {
for (int j = 0; j < 5; j++) {
if (valores[j] <= menorEdad) {
Console.WriteLine("Menor de edad: " + nombres[j] + ", Edad: " + valores[j]);
if (opcionEntradaLocal == "e") {
if (opcionEntradaLocal != "a" && opcionEntradaLocal != "b" && opcionEntradaLocal != "c" && opcionEntradaLocal != "d" && opcionEntradaLocal != "e") {
Console.WriteLine("Opcion erronea, introduce una opcion entre a-e");
public void problema2() {
Console.WriteLine("-----------------------");
Console.WriteLine("2. Problema 2 ");
Console.WriteLine("-----------------------");
Console.WriteLine("¿Cuantos numeros introduciras?: ");
int opcionEntradaLocal = int.Parse(Console.ReadLine());
int[] arrayNumeros = new int[opcionEntradaLocal];
for (int z = 0; z < opcionEntradaLocal; z++) {
Console.WriteLine((z + 1) + ". Ingresa el numero: ");
arrayNumeros[z] = int.Parse(Console.ReadLine());
Console.WriteLine("-----------------------");
Console.WriteLine("Elemento a buscar: ");
int elementoBuscar = int.Parse(Console.ReadLine());
for (int z1 = 0; z1 < opcionEntradaLocal; z1++) {
Console.WriteLine("Elemento (" + arrayNumeros[z1] + "), Posicion: " + z1);
for (int z1 = 0; z1 < opcionEntradaLocal; z1++) {
if (arrayNumeros[z1] == elementoBuscar) {
Console.WriteLine("Elemento encontrado (" + elementoBuscar + "), Posicion: " + z1);
if (banderaPosicion == 0) {
Console.WriteLine("No se encontro el elemento con el valor (" + elementoBuscar + ")");
public void problema3() {
Console.WriteLine("-----------------------");
Console.WriteLine("3. Problema 3 ");
Console.WriteLine("-----------------------");
int[, ] matriz1 = new int[3, 3];
int[, ] matriz2 = new int[3, 3];
int[, ] matrizAuxResultado = new int[3, 3];
int varAuxiliarlocal = 0;
Console.WriteLine("-----------------Matriz 1 -----------------");
for (int t1 = 0; t1 < 3; t1++) {
for (int t2 = 0; t2 < 3; t2++) {
Console.WriteLine("Ingresa el valor de la posicion [" + t1 + "," + t2 + "]: ");
matriz1[t1, t2] = int.Parse(Console.ReadLine());
Console.WriteLine("-----------------------");
Console.WriteLine("-----------------Matriz 2 -----------------");
for (int t1 = 0; t1 < 3; t1++) {
for (int t2 = 0; t2 < 3; t2++) {
Console.WriteLine("Ingresa el valor de la posicion [" + t1 + "," + t2 + "]: ");
matriz2[t1, t2] = int.Parse(Console.ReadLine());
Console.WriteLine("-----------------------");
Console.WriteLine("-----------------Matriz 1 -----------------");
for (int t1 = 0; t1 < 3; t1++) {
for (int t2 = 0; t2 < 3; t2++) {
line = line + " " + matriz1[t1, t2];
Console.WriteLine("-----------------Matriz 2 -----------------");
for (int t1 = 0; t1 < 3; t1++) {
for (int t2 = 0; t2 < 3; t2++) {
line = line + " " + matriz2[t1, t2];
while (varAuxiliarlocal == 0) {
Console.WriteLine("--- Menu local ---");
Console.WriteLine("Opciones ");
Console.WriteLine("a. Resultado de la suma de las matrices");
Console.WriteLine("b. Resultado de la resta de las matrices");
Console.WriteLine("c. Resultado de la multiplicacion de las matrices ");
Console.WriteLine("d. Salir ");
Console.WriteLine("-----------------------");
Console.WriteLine("Introduce la opcion: ");
String opcionEntradaLocal;
opcionEntradaLocal = Console.ReadLine();
if (opcionEntradaLocal == "a") {
for (int t1 = 0; t1 < 3; t1++) {
for (int t2 = 0; t2 < 3; t2++) {
matrizAuxResultado[t1, t2] = matriz1[t1, t2] + matriz2[t1, t2];
Console.WriteLine("Resultado de la suma: ");
for (int t1 = 0; t1 < 3; t1++) {
for (int t2 = 0; t2 < 3; t2++) {
line = line + " " + matrizAuxResultado[t1, t2];
if (opcionEntradaLocal == "b") {
for (int t1 = 0; t1 < 3; t1++) {
for (int t2 = 0; t2 < 3; t2++) {
matrizAuxResultado[t1, t2] = matriz1[t1, t2] - matriz2[t1, t2];
Console.WriteLine("Resultado de la resta: ");
for (int t1 = 0; t1 < 3; t1++) {
for (int t2 = 0; t2 < 3; t2++) {
line = line + " " + matrizAuxResultado[t1, t2];
if (opcionEntradaLocal == "c") {
for (int t1 = 0; t1 < 3; t1++) {
for (int t2 = 0; t2 < 3; t2++) {
for (int t3 = 0; t3 < 3; t3++) {
matrizAuxResultado[t1,t2] += matriz1[t1,t3] * matriz2[t3,t2];
Console.WriteLine("Resultado de la multiplicacion: ");
for (int t1 = 0; t1 < 3; t1++) {
for (int t2 = 0; t2 < 3; t2++) {
line = line + " " + matrizAuxResultado[t1, t2];
if (opcionEntradaLocal == "d") {
if (opcionEntradaLocal != "a" && opcionEntradaLocal != "b" && opcionEntradaLocal != "c" && opcionEntradaLocal != "d") {
Console.WriteLine("Opcion erronea, introduce una opcion entre a-e");