C sharp - Duda sobre un ejercicio

 
Vista:
sin imagen de perfil

Duda sobre un ejercicio

Publicado por javier (16 intervenciones) el 15/11/2022 14:21:52
Hola queria comentar que estoy haciendo un ejercicio sobre la frecuencia que lo tengo casi pero no me sale



Mi codigo









using System.Text;
internal class Program
{
public static int[] Arra()
{
int notasRecogidas = 0;
int notasnumero = 0;


int[] notas = new int[5];


for (int i = 0; i < notas.Length; i++)
{

do
{
Console.Write("Ingrese nota (entre 0-10): ");
notasRecogidas = int.Parse(Console.ReadLine());
notas[i] = notasRecogidas;
if (notas[i] < 0 || notas[i] > 10)
{
notasnumero++;

Console.WriteLine($"Nota fuera de rango {notasnumero}");
}

Console.WriteLine($" {notas[i]} ");


} while (notas[i] < 0 || notas[i] > 10);










}
return notas;
}

static void FrecuenciaNotas(int[] Array)
{
int[] FrecuenciaNota = new int[11];
int i, j;
for (i = 0; i < 11; i++)
{
for (j = 0; j < Array.Length; j++)
{
if (i ==FrecuenciaNota[j])
{
FrecuenciaNota[i]++;
}

}
Console.WriteLine($"Nota {i}, {FrecuenciaNota[j]} veces.");
}
}


private static void Main(string[] args)
{
int[] notas = Arra();
FrecuenciaNotas(notas);


Console.ReadLine();
}

}

Gracias
Valora esta pregunta
Me gusta: Está pregunta es útil y esta claraNo me gusta: Está pregunta no esta clara o no es útil
0
Responder