-
-
Save parzibyte/30ab865d2de2069cf27b11af6043a2c3 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
https://parzibyte.me/blog | |
*/ | |
#include <iostream> | |
using namespace std; | |
int main() | |
{ | |
// Declarar la cantidad de notas por si el valor cambia | |
const int cantidadNotas = 5; | |
double notas[cantidadNotas]; | |
// Solicitar notas | |
for (int i = 0; i < cantidadNotas; i++) | |
{ | |
cout << "Ingrese la nota " << i + 1 << ": "; | |
// Guardar en el arreglo | |
cin >> notas[i]; | |
} | |
// Solicitar calificación de examen semestral | |
double calificacionExamenSemestral; | |
cout << "Ingrese calificación de examen semestral: "; | |
cin >> calificacionExamenSemestral; | |
// Ahora vamos a hacer cálculos | |
// La sumatoria para promediar | |
double sumatoria = 0; | |
// Recorrer notas, imprimir y sumar a la sumatoria | |
for (int i = 0; i < cantidadNotas; i++) | |
{ | |
sumatoria = sumatoria + notas[i]; | |
cout << "Nota " << i + 1 << " . Calificación: " << notas[i] << endl; | |
} | |
double promedioNotas = sumatoria / cantidadNotas; | |
// Momento de calcular el promedio final | |
double promedioFinal = (promedioNotas + calificacionExamenSemestral) / 2; | |
// Calcular la letra | |
string letra = ""; | |
if (promedioFinal == 100) | |
{ | |
letra = "A"; | |
} | |
else if (promedioFinal >= 80) | |
{ | |
letra = "B"; | |
} | |
else if (promedioFinal >= 70) | |
{ | |
letra = "C"; | |
} | |
else if (promedioFinal >= 60) | |
{ | |
letra = "D"; | |
} | |
else | |
{ | |
letra = "E"; | |
} | |
// Imprimir resultados | |
cout << "Total notas parciales: " << sumatoria << endl; | |
cout << "Promedio notas parciales: " << promedioNotas << endl; | |
cout << "Nota del semestral: " << calificacionExamenSemestral << endl; | |
cout << "Nota final: " << promedioFinal << ". Obtiene " << letra << endl; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment