diff options
| author | Anhgelus Morhtuuzh <anhgelus@anhgelus.world> | 2025-03-27 17:24:15 +0100 |
|---|---|---|
| committer | Anhgelus Morhtuuzh <anhgelus@anhgelus.world> | 2025-03-27 17:24:15 +0100 |
| commit | c49b969659d8761442a560f8feda436bfb7b01e8 (patch) | |
| tree | 70e34b6cc1b4285e009f9acace8c87a869d6ccb2 /semestre 2/informatique/tme/semaine5/28_participation_frais.c | |
| parent | 4a3afaf44aa29e66a6c879c60322015a2920a5ab (diff) | |
Ajout des cours du 10 au 27 mars
Diffstat (limited to 'semestre 2/informatique/tme/semaine5/28_participation_frais.c')
| -rw-r--r-- | semestre 2/informatique/tme/semaine5/28_participation_frais.c | 5 |
1 files changed, 3 insertions, 2 deletions
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; } } |
