Advertisement
Guest User

Untitled

a guest
Dec 9th, 2019
114
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.30 KB | None | 0 0
  1. #include <stdio.h>
  2. #include <stdlib.h>
  3. #include <string.h>
  4. #define n 6
  5.  
  6. int main()
  7. {
  8. float mont[5][6], jour, s, max;
  9. char jours[5][9]={"Lundi", "Mardi", "Mercredi", "Jeudi", "Vendredi"};
  10. char etudiants[n][20];
  11. int i, j, pos;
  12.  
  13. for(j=0; j<n; j++)
  14. {
  15. printf("\nNom %d : ", j+1);
  16. gets(etudiants[j]); // scanf("%s", noms[i]);
  17. }
  18.  
  19. for(i=0;i<5;i++)
  20. {
  21. printf("\nJour %s : ", jours[i]);
  22. jour=0;
  23.  
  24. for(j=0; j<6;j++)
  25. {
  26. printf("\nPour l'etudiant %s : ", etudiants[j]);
  27. scanf("%f", &mont[i][j]);
  28. jour=jour+mont[i][j];
  29. }
  30. printf("\nSomme total du jour %s : %.2f\n", jours[i], jour);
  31. }
  32.  
  33. for(j=0; j<6; j++)
  34. {
  35. s=0;
  36.  
  37. for(i=0; i<5; i++)
  38. {
  39. s=s+mont[i][j];
  40. }
  41. printf("\nDepense totale pour la personne %s est %.2f\n", etudiants[j], s);
  42. }
  43.  
  44. for(j=0; j<6; j++)
  45. {
  46. pos=0;
  47. max=mont[0][j];
  48.  
  49. for(i=0; i<5; i++)
  50. {
  51. if(mont[i][j]>max)
  52. {
  53. max=mont[i][j];
  54. pos=i;
  55. }
  56. }
  57.  
  58. printf("\nPersonne : %s -> jour : %s -> maximum : %.2f", etudiants[j], jours[pos], max);
  59. }
  60. return 0;
  61. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement