diff options
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; } } |
