Guest User

Untitled

a guest
Jan 20th, 2018
79
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.36 KB | None | 0 0
  1. class Program
  2. {
  3. //CREAR ARREGLO GLOBAL
  4. float[] calificaciones = new float[0];
  5.  
  6. public void Main(string[] args)
  7. {
  8. //VARIBALES NECESARIAS
  9. int cantidad = 0;
  10. string valor = "";
  11.  
  12. //SE PIDEN LA CANTIDAD DE ALUMNOS
  13. Console.Write("INGRESE LA CANTIDAD DE ALUMNOS: ");
  14. valor = Console.ReadLine();
  15. cantidad = Convert.ToInt32(valor);
  16. float[] calificaciones = new float[cantidad];
  17. obtenerNotas(cantidad);
  18. obtenerPromedio(cantidad);
  19. notaMinima(cantidad);
  20. notaMaxima(cantidad);
  21.  
  22. //PONER LOS RESULTADOS
  23. Console.Clear();
  24. Console.WriteLine(); //DONDE SALE EL ERROR
  25. Console.WriteLine(notaMaxima(float)); //DONDE SALE EL ERROR
  26. Console.WriteLine(notaMinima(float)); //DONDE SALE EL ERROR
  27.  
  28. Console.ReadKey();
  29.  
  30. }
  31.  
  32. //CAPTURAR LA INFORMACIÓN DE LAS NOTAS
  33. public void obtenerNotas (int a)
  34. {
  35. int cantidad = a;
  36. for (int n = 0; n < cantidad ; n++)
  37. {
  38. Console.Clear();
  39. Console.Write("INGRESE LA CALIFICACIÓN DEL ALUMNO NÚMERO " + (n+1) + ": ");
  40. string valor = Console.ReadLine();
  41. calificaciones[n] = Convert.ToSingle(valor);
  42. }
  43. }
  44.  
  45. //ENCONTRAMOS EL PROMEDIO
  46. public float obtenerPromedio(int b)
  47. {
  48. int cantidad = b;
  49. float suma = 0;
  50. for (int n = 0; n < cantidad; n++)
  51. {
  52. suma += calificaciones[n];
  53. }
  54.  
  55. float promedio = suma / cantidad;
  56. return promedio;
  57.  
  58. }
  59.  
  60. //ENCONTRAMOS LA CALIFICACIÓN MÁS BAJA
  61. public float notaMinima (int c)
  62. {
  63. int cantidad = c;
  64. float minima = 0;
  65. for (int n = 0; n < cantidad; n++)
  66. {
  67. if (calificaciones[n] < minima)
  68. minima = calificaciones[n];
  69. }
  70. return minima;
  71.  
  72. }
  73.  
  74. //ENCONTRAMOS LA CALIFICACIÓN MÁS ALTA
  75. public float notaMaxima(int d)
  76. {
  77. int cantidad = d;
  78. float maxima = 0;
  79. for (int n = 0; n < cantidad; n++)
  80. {
  81. if (calificaciones[n] > maxima)
  82. maxima = calificaciones[n];
  83. }
  84. return maxima;
  85. }
  86.  
  87. }
Add Comment
Please, Sign In to add comment