From d270bc467402e1f0c341c5e94ae45df751bd2d7e Mon Sep 17 00:00:00 2001 From: Louis Gallet Date: Sun, 8 Sep 2024 16:08:43 +0200 Subject: [PATCH] feat: :sparkles: Create basic exam --- Fundamentals/Makefile | 1 + Fundamentals/exos.c | 18 +++++++++++++++ Fundamentals/exos.h | 12 ++++++++++ Fundamentals/main.c | 54 +++++++++++++++++++++++++++++++++++++++++++ 4 files changed, 85 insertions(+) create mode 100644 Fundamentals/Makefile create mode 100644 Fundamentals/exos.c create mode 100644 Fundamentals/exos.h create mode 100644 Fundamentals/main.c diff --git a/Fundamentals/Makefile b/Fundamentals/Makefile new file mode 100644 index 0000000..9d0a740 --- /dev/null +++ b/Fundamentals/Makefile @@ -0,0 +1 @@ +#To be completed diff --git a/Fundamentals/exos.c b/Fundamentals/exos.c new file mode 100644 index 0000000..50b3ff9 --- /dev/null +++ b/Fundamentals/exos.c @@ -0,0 +1,18 @@ +#include +#include "exos.h" + + +int sommeNombresPairs(int n); + +void afficherTriangle(int n); + +int valeurMax(int tab[], int n); + +void additionMatrice(int matrice1[3][3], int matrice2[3][3], int resultat[3][3]); + +void afficherMatrice(int matrice[3][3]); + +void inverserChaine(char chaine[]); + +int compterVoyelles(char chaine[]); + diff --git a/Fundamentals/exos.h b/Fundamentals/exos.h new file mode 100644 index 0000000..6100a2f --- /dev/null +++ b/Fundamentals/exos.h @@ -0,0 +1,12 @@ +#include +#ifndef F_EXOS_H +#define F_EXOS_H + +int sommeNombresPairs(int n); +void afficherTriangle(int n); +int valeurMax(int tab[], int n); +void additionMatrice(int matrice1[3][3], int matrice2[3][3], int resultat[3][3]); +void afficherMatrice(int matrice[3][3]); +void inverserChaine(char chaine[]); +int compterVoyelles(char chaine[]); +#endif diff --git a/Fundamentals/main.c b/Fundamentals/main.c new file mode 100644 index 0000000..a6827dc --- /dev/null +++ b/Fundamentals/main.c @@ -0,0 +1,54 @@ +#include +#include "exos.h" + +int main() { + /* + printf("--- Exercice 1 ---\n"); + printf("Sommes nombres pairs de 1 à 10: %d\n", sommeNombresPairs(10)); + printf("Sommes nombres pairs de 1 à 100: %d\n", sommeNombresPairs(100)); + printf("Sommes nombres pairs de 1 à 1000: %d\n", sommeNombresPairs(1000)); + */ + + /* + printf("\n--- Exercice 2 ---\n"); + printf("Afficher triange de 5 lignes:\n"); + afficherTriangle(5); + printf("\nAfficher triange de 10 lignes:\n"); + afficherTriangle(10); + */ + + /* + printf("\n--- Exercice 3 ---\n"); + int tab1[] = {1, 2, 3, 4, 5}; + printf("Valeur max de 1, 2, 3, 4, 5: %d\n", valeurMax(tab1, 5)); + int tab2[] = {10, 5, 7}; + printf("Valeur max de 10, 5, 7: %d\n", valeurMax(tab2, 3)); + int tab3[] = {3, 5, 17}; + printf("Valeur max de 3, 5, 17: %d\n", valeurMax(tab3, 3)); + */ + + /* + printf("\n--- Exercice 4 ---\n"); + int matrice1[3][3] = {{1, 2, 3}, {4, 5, 6}, {7, 8, 9}}; + int matrice2[3][3] = {{9, 8, 7}, {6, 5, 4}, {3, 2, 1}}; + int resultat[3][3]; + additionMatrice(matrice1, matrice2, resultat); + printf("Addition de matrice1 et matrice2:\n"); + afficherMatrice(resultat); + */ + + /* + printf("\n--- Exercice 5 ---\n"); + char chaine[] = "Bonjour"; + inverserChaine(chaine); + printf("Inverser chaine 'Bonjour': %s\n", chaine); + */ + + /* + printf("\n--- Exercice 6 ---\n"); + char chaine[] = "Examen de programmation"; + printf("Nombre de voyelles dans 'Examen de programmation': %d\n", compterVoyelles(chaine)); + */ + return 0; +} +