This commit is contained in:
Le Stagiaire
2024-11-19 15:11:05 +01:00
parent f56d985cad
commit 838f7415fb
7 changed files with 148 additions and 3 deletions

42
CPP/Source7.cpp Normal file
View File

@ -0,0 +1,42 @@
/*
* Programme d'affichage d'une moyenne de notes
* Par Florian Goussot
* BTS CIEL 2e ann<6E>e
* Fait le 05/11/2024 <20> 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", &notes[i]);
if (notes[i] < min) {
min = notes[i];
}
if (notes[i] > max) {
max = notes[i];
}
}
printf_s("\nR<EFBFBD>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 <20>lev<65>e est de %.2f\n", max);
printf_s("\n\nAppuyez sur Echap pour quitter...");
} while (_getch() != 27);
return 0;
}