From c49b969659d8761442a560f8feda436bfb7b01e8 Mon Sep 17 00:00:00 2001 From: Anhgelus Morhtuuzh Date: Thu, 27 Mar 2025 17:24:15 +0100 Subject: Ajout des cours du 10 au 27 mars --- semestre 2/informatique/tme/semaine5/28_participation_frais.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'semestre 2/informatique/tme/semaine5/28_participation_frais.c') diff --git a/semestre 2/informatique/tme/semaine5/28_participation_frais.c b/semestre 2/informatique/tme/semaine5/28_participation_frais.c index e5aff0d..96da9b7 100644 --- a/semestre 2/informatique/tme/semaine5/28_participation_frais.c +++ b/semestre 2/informatique/tme/semaine5/28_participation_frais.c @@ -13,9 +13,10 @@ void init_tab(float tab[NB_AMIS][NB_JOURS]){ void random_tab(float tab[NB_AMIS][NB_JOURS], int j) { int a = rand()%NB_AMIS; int v = rand()%21+30; - tab[a][j] = v; + float to_pay = (float) v/(-NB_AMIS); + tab[a][j] = v + to_pay; for (int i = 0; i < NB_AMIS; i++) { - if (i != a) tab[i][j] = (float) v/(-NB_AMIS+1); + if (i != a) tab[i][j] = to_pay; } } -- cgit v1.2.3