From 29a8c0fdaf0f912948168eb563770b7904cd17fe Mon Sep 17 00:00:00 2001 From: Mazen BEN GHORBAL Date: Tue, 10 Dec 2024 15:32:05 +0100 Subject: [PATCH] Supprimer ex2 --- ex2 | 52 ---------------------------------------------------- 1 file changed, 52 deletions(-) delete mode 100644 ex2 diff --git a/ex2 b/ex2 deleted file mode 100644 index 5805525..0000000 --- a/ex2 +++ /dev/null @@ -1,52 +0,0 @@ -main.c - -#include -#include -#include "moyenne.h" - -int main(int argc, char *argv[]) { - if (argc < 2) { - printf("Usage : %s \n", argv[0]); - return 1; - } - - int taille = argc - 1; - int tableau[taille]; - int i; - - for (i = 0; i < taille; i++) { - tableau[i] = atoi(argv[i + 1]); - } - - float moyenne = calculer_moyenne(tableau, taille); - printf("Moyenne : %.2f\n", moyenne); - - return 0; -} - - -moyenne.c - -#include "moyenne.h" - -float calculer_moyenne(int *tableau, int taille) { - int somme = 0; - int i; - for (i = 0; i < taille; i++) { - somme += tableau[i]; - } - return (float)somme / taille; -} - -moyenne.h - -#include "moyenne.h" - -float calculer_moyenne(int *tableau, int taille) { - int somme = 0; - int i; - for (i = 0; i < taille; i++) { - somme += tableau[i]; - } - return (float)somme / taille; -}