Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- class Program
- {
- //CREAR ARREGLO GLOBAL
- float[] calificaciones = new float[0];
- public void Main(string[] args)
- {
- //VARIBALES NECESARIAS
- int cantidad = 0;
- string valor = "";
- //SE PIDEN LA CANTIDAD DE ALUMNOS
- Console.Write("INGRESE LA CANTIDAD DE ALUMNOS: ");
- valor = Console.ReadLine();
- cantidad = Convert.ToInt32(valor);
- float[] calificaciones = new float[cantidad];
- obtenerNotas(cantidad);
- obtenerPromedio(cantidad);
- notaMinima(cantidad);
- notaMaxima(cantidad);
- //PONER LOS RESULTADOS
- Console.Clear();
- Console.WriteLine(); //DONDE SALE EL ERROR
- Console.WriteLine(notaMaxima(float)); //DONDE SALE EL ERROR
- Console.WriteLine(notaMinima(float)); //DONDE SALE EL ERROR
- Console.ReadKey();
- }
- //CAPTURAR LA INFORMACIÓN DE LAS NOTAS
- public void obtenerNotas (int a)
- {
- int cantidad = a;
- for (int n = 0; n < cantidad ; n++)
- {
- Console.Clear();
- Console.Write("INGRESE LA CALIFICACIÓN DEL ALUMNO NÚMERO " + (n+1) + ": ");
- string valor = Console.ReadLine();
- calificaciones[n] = Convert.ToSingle(valor);
- }
- }
- //ENCONTRAMOS EL PROMEDIO
- public float obtenerPromedio(int b)
- {
- int cantidad = b;
- float suma = 0;
- for (int n = 0; n < cantidad; n++)
- {
- suma += calificaciones[n];
- }
- float promedio = suma / cantidad;
- return promedio;
- }
- //ENCONTRAMOS LA CALIFICACIÓN MÁS BAJA
- public float notaMinima (int c)
- {
- int cantidad = c;
- float minima = 0;
- for (int n = 0; n < cantidad; n++)
- {
- if (calificaciones[n] < minima)
- minima = calificaciones[n];
- }
- return minima;
- }
- //ENCONTRAMOS LA CALIFICACIÓN MÁS ALTA
- public float notaMaxima(int d)
- {
- int cantidad = d;
- float maxima = 0;
- for (int n = 0; n < cantidad; n++)
- {
- if (calificaciones[n] > maxima)
- maxima = calificaciones[n];
- }
- return maxima;
- }
- }
Add Comment
Please, Sign In to add comment