42 lines
1.0 KiB
C++
42 lines
1.0 KiB
C++
/*
|
|
* Programme d'affichage d'une moyenne de notes
|
|
* Par Florian Goussot
|
|
* BTS CIEL 2e année
|
|
* Fait le 05/11/2024 à Nancy
|
|
*/
|
|
#include <stdio.h>
|
|
#include <conio.h>
|
|
#include <stdlib.h>
|
|
|
|
int main(void) {
|
|
do {
|
|
system("cls");
|
|
printf_s("\t\t\tAffichage d'une moyenne de notes\n");
|
|
printf_s("Donnez le nombre de notes : ");
|
|
float notes[10];
|
|
double max = 0, min = 20, moy = 0;
|
|
int total_notes = 0;
|
|
scanf_s("%i", &total_notes);
|
|
for (int i = 0; i <= total_notes - 1; i++) {
|
|
printf_s("Entrez une note :");
|
|
scanf_s("%f", ¬es[i]);
|
|
if (notes[i] < min) {
|
|
min = notes[i];
|
|
}
|
|
if (notes[i] > max) {
|
|
max = notes[i];
|
|
}
|
|
}
|
|
printf_s("\nRécapitulatif des notes : ");
|
|
for (int j = 0; j <= total_notes - 1; j++) {
|
|
printf_s("%.2f\t", notes[j]);
|
|
moy += notes[j];
|
|
}
|
|
moy /= total_notes;
|
|
printf_s("\nLa moyenne est de %.2f\n", moy);
|
|
printf_s("La note la plus basse est de %.2f\n", min);
|
|
printf_s("La note la plus élevée est de %.2f\n", max);
|
|
printf_s("\n\nAppuyez sur Echap pour quitter...");
|
|
} while (_getch() != 27);
|
|
return 0;
|
|
} |