Untitled

 avatar
unknown
plain_text
2 years ago
2.2 kB
4
Indexable
/******************************************************************************

                              Online C++ Compiler.
               Code, Compile, Run and Debug C++ program online.
Write your code in this editor and press "Run" button to compile and execute it.

*******************************************************************************/

#include <iostream>

using namespace std;

int
main ()
{
    int nestudiantes = 10;
    float  notas[nestudiantes];
    
    float nota;
    float sumaNotas = 0;
    float notaPromedio = 0;

    int notasReprobadas = 0;
    int notasAprobadas = 0;
    int notasEncimaPromedio = 0;
    int notasDebajoPromedio = 0;
    
    for (int i = 0; i < nestudiantes; i++)
    {
        cout<<"Nota del estudiante "<<i+1<<endl;
        cin>>nota;
        if(nota>=1 && nota<=5){
            notas[i] = nota;
            sumaNotas = sumaNotas + notas[i];
        }else{
            cout<<"La nota no se encuentra en el rango adecuado "<<endl;
            return 0;
        }
        
    }
    float notaAlta = notas[0];
    float notaBaja = notas[0];
    
    notaPromedio = sumaNotas/nestudiantes;
    
    for (int i = 0; i < nestudiantes; i++)
    {
        
        if (notas[i] > notaAlta){
            notaAlta = notas[i];
        }
        
        if (notas[i] < notaBaja){
            notaBaja = notas[i];
            
        }
        
        if (notas[i] >= 3){
            notasAprobadas = notasAprobadas + 1;
        }
        if (notas[i] < 3){
            notasReprobadas = notasReprobadas + 1;
        }
        
         if (notas[i] > notaPromedio){
            notasEncimaPromedio = notasEncimaPromedio +1;
        }
        if (notas[i] < notaPromedio){
            notasDebajoPromedio = notasDebajoPromedio + 1;
        }
    }
    
    cout<<"Nota promedio: "<<sumaNotas/nestudiantes<<endl;
    cout<<"Nota Alta: "<<notaAlta<<endl;
    cout<<"Nota Baja: "<<notaBaja<<endl;
    cout<<"Notas Aprobadas: "<<notasAprobadas<<endl;
    cout<<"Notas Reprobadas: "<<notasReprobadas<<endl;
    cout<<"Notas Encima del Promedio:"<<notasEncimaPromedio<<endl;
    cout<<"Notas debajo del Promedio:"<<notasDebajoPromedio<<endl;
    

  return 0;
}