diff options
| author | Anhgelus Morhtuuzh <anhgelus@anhgelus.world> | 2025-01-31 15:39:30 +0100 |
|---|---|---|
| committer | Anhgelus Morhtuuzh <anhgelus@anhgelus.world> | 2025-01-31 15:39:30 +0100 |
| commit | d7c69934248f3fab4988c0d37c11feba25d653b8 (patch) | |
| tree | 6c396257cb21374e13a26b8f78c05353806220bc /semestre 2/informatique/td/1- exemples/constant.c | |
| parent | ed631f52ee7af474625e37c6855c7c55903317fc (diff) | |
Ajout du début du deuxième semestre
Diffstat (limited to 'semestre 2/informatique/td/1- exemples/constant.c')
| -rw-r--r-- | semestre 2/informatique/td/1- exemples/constant.c | 26 |
1 files changed, 26 insertions, 0 deletions
diff --git a/semestre 2/informatique/td/1- exemples/constant.c b/semestre 2/informatique/td/1- exemples/constant.c new file mode 100644 index 0000000..37864ae --- /dev/null +++ b/semestre 2/informatique/td/1- exemples/constant.c @@ -0,0 +1,26 @@ +#include <stdio.h> + +#define TNORMAL 11.4 +#define TMOINS 4.5 +#define TMOINS26S 4.9 +#define TMOINS26WE 7.9 +#define TMATIN 7.1 + +float prixPlace(int age, int jour, float h){ + if (age < 14) return TMOINS; + if (age < 26 && jour < 6) return TMOINS26S; + if (h < 11 && h > 8) return TMATIN; + if (age < 26) return TMOINS26WE; + return TNORMAL; +} + +int main(){ + printf("%.2f€ prix pour %d ans le %de jour de la semaine à %.1fh\n", prixPlace(13, 5, 13), 13, 5, 13.0); + printf("%.2f€ prix pour %d ans le %de jour de la semaine à %.1fh\n", prixPlace(14, 5, 13), 14, 5, 13.0); + printf("%.2f€ prix pour %d ans le %de jour de la semaine à %.1fh\n", prixPlace(14, 6, 13), 14, 6, 13.0); + printf("%.2f€ prix pour %d ans le %de jour de la semaine à %.1fh\n", prixPlace(14, 6, 10), 14, 6, 10.0); + printf("%.2f€ prix pour %d ans le %de jour de la semaine à %.1fh\n", prixPlace(28, 6, 10), 28, 6, 10.0); + printf("%.2f€ prix pour %d ans le %de jour de la semaine à %.1fh\n", prixPlace(28, 6, 15), 28, 6, 15.0); + return 0; +} + |
