Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <stdio.h>
- #include <stdlib.h>
- #include <string.h>
- #define n 6
- int main()
- {
- float mont[5][6], jour, s, max;
- char jours[5][9]={"Lundi", "Mardi", "Mercredi", "Jeudi", "Vendredi"};
- char etudiants[n][20];
- int i, j, pos;
- for(j=0; j<n; j++)
- {
- printf("\nNom %d : ", j+1);
- gets(etudiants[j]); // scanf("%s", noms[i]);
- }
- for(i=0;i<5;i++)
- {
- printf("\nJour %s : ", jours[i]);
- jour=0;
- for(j=0; j<6;j++)
- {
- printf("\nPour l'etudiant %s : ", etudiants[j]);
- scanf("%f", &mont[i][j]);
- jour=jour+mont[i][j];
- }
- printf("\nSomme total du jour %s : %.2f\n", jours[i], jour);
- }
- for(j=0; j<6; j++)
- {
- s=0;
- for(i=0; i<5; i++)
- {
- s=s+mont[i][j];
- }
- printf("\nDepense totale pour la personne %s est %.2f\n", etudiants[j], s);
- }
- for(j=0; j<6; j++)
- {
- pos=0;
- max=mont[0][j];
- for(i=0; i<5; i++)
- {
- if(mont[i][j]>max)
- {
- max=mont[i][j];
- pos=i;
- }
- }
- printf("\nPersonne : %s -> jour : %s -> maximum : %.2f", etudiants[j], jours[pos], max);
- }
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement