79593013

Date: 2025-04-25 17:17:25
Score: 4
Natty:
Report link

tengo este codigo pero no me quere dar se me queda en abtascado

using System;
using System.Collections;
using System.Collections.Generic;
using System.Linq;

class Program
{
    static void Main()
    {

        int[] LICEO = Enumerable.Range(4, 15).ToArray();


        List<int> IUSH = Enumerable.Range(18, 43).ToList();


        Console.WriteLine("Ingrese las edades de RONDALLA separadas por punto y coma (;):");
        ArrayList RONDALLA = new ArrayList(Console.ReadLine().Split(';').Select(double.Parse).ToArray());


        Console.WriteLine("LICEO : " + string.Join(", ", LICEO));
        Console.WriteLine("IUSH : " + string.Join(", ", IUSH));
        Console.WriteLine("RONALLA : " + string.Join(", ", RONDALLA.ToArray()));

        int diferencia = (int)RONDALLA.Cast<int>().Max() - LICEO.Min();
        Console.WriteLine($"Diferencia entre la edad mayor de RONDALLA y la menor del LICEO es: {diferencia}");

        int sumaIUSH = IUSH.Sum();
        double promedioIush = IUSH.Average();
        Console.WriteLine($"La sumatira de las edades de IUSH es: {sumaIUSH}");
        Console.WriteLine($"El promedio de las edades de IUSH es: {promedioIush}");

        Console.WriteLine("Ingrese la edad que sea buscar del LICEO:");
        int edadBuscadaLICEO = int.Parse(Console.ReadLine());
        int posicionLICEO = Array.IndexOf(LICEO, edadBuscadaLICEO);
        if (posicionLICEO != -1)
        {
            Console.WriteLine($"La edad {edadBuscadaLICEO} existe en la posición {posicionLICEO}.");
            Console.WriteLine($"La edad en IUSH en la misma posición: {(posicionLICEO < IUSH.Count ? IUSH[posicionLICEO].ToString() : "N/A")}");
            Console.WriteLine($"La edad en RONDALLA en la misma posición: {(posicionLICEO < RONDALLA.Count ? RONDALLA[posicionLICEO].ToString() : "N/A")}");
        }
        else
        {
            Console.WriteLine($"La edad {edadBuscadaLICEO} no existe en el LICEO.");
        }

        List<int> SALAZAR = LICEO.Concat(IUSH).ToList();
        Console.WriteLine("Edades de SALAZAR: " + string.Join(", ", SALAZAR));

        SALAZAR.Sort();
        SALAZAR.Reverse();
        Console.WriteLine("5 edades más altas de SALAZAR: " + string.Join(", ", SALAZAR.Take(5)));
        Console.WriteLine("5 edades más bajas de SALAZAR: " + string.Join(", ", SALAZAR.OrderBy(x => x).Take(5)));

        int[] edadesEntre15y25 = SALAZAR.Where(edad => edad >= 15 && edad <= 25).ToArray();
        int cantidad = edadesEntre15y25.Length;
        double porcentaje = (double)cantidad / SALAZAR.Count * 100;
        Console.WriteLine($"Cantidad de edades entre 15 y 25 años: {cantidad}");
        Console.WriteLine($"Porcentaje de edades entre 15 y 25 años: {porcentaje:F2}%");

    }

}
Reasons:
  • Blacklisted phrase (2): tengo
  • RegEx Blacklisted phrase (2.5): misma
  • Long answer (-1):
  • Has code block (-0.5):
  • Low reputation (1):
Posted by: Juan Jose Zapata Jaramillo