feat: Create basic exam

This commit is contained in:
Louis Gallet 2024-09-08 16:08:43 +02:00
commit d270bc4674
Signed by: lgallet
GPG Key ID: 84D3DF1528A84511
4 changed files with 85 additions and 0 deletions

1
Fundamentals/Makefile Normal file
View File

@ -0,0 +1 @@
#To be completed

18
Fundamentals/exos.c Normal file
View File

@ -0,0 +1,18 @@
#include <stdio.h>
#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[]);

12
Fundamentals/exos.h Normal file
View File

@ -0,0 +1,12 @@
#include <stdio.h>
#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

54
Fundamentals/main.c Normal file
View File

@ -0,0 +1,54 @@
#include <stdio.h>
#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;
}