From d7c69934248f3fab4988c0d37c11feba25d653b8 Mon Sep 17 00:00:00 2001 From: Anhgelus Morhtuuzh Date: Fri, 31 Jan 2025 15:39:30 +0100 Subject: =?UTF-8?q?Ajout=20du=20d=C3=A9but=20du=20deuxi=C3=A8me=20semestre?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../informatique/tme/semaine1/07_tour_londres.c | 37 ++++++++++++++++++++++ 1 file changed, 37 insertions(+) create mode 100644 semestre 2/informatique/tme/semaine1/07_tour_londres.c (limited to 'semestre 2/informatique/tme/semaine1/07_tour_londres.c') diff --git a/semestre 2/informatique/tme/semaine1/07_tour_londres.c b/semestre 2/informatique/tme/semaine1/07_tour_londres.c new file mode 100644 index 0000000..92f0cff --- /dev/null +++ b/semestre 2/informatique/tme/semaine1/07_tour_londres.c @@ -0,0 +1,37 @@ +#include +#define ADU 22.7 +#define KID 10.75 +#define FAMILLY 57.8 +#define COMPARE_FLOAT_PRECISION 0.00001 + +float prixEntree(int adus, int kids){ + float no_familly = adus * ADU + kids * KID; + float with_familly = FAMILLY; + int r_adus = adus - 2; + int r_kids = kids - 3; + if (r_adus > 0){ + with_familly += r_adus * ADU; + } + if (r_kids > 0){ + with_familly += r_kids * KID; + } + if (no_familly < with_familly) return no_familly; + return with_familly; +} + +int compareFloat(float f1, float f2, float eps){ + /* Prend trois floats (f1, f2 et eps) et renvoie |f1-f2|