Skip to content

Instantly share code, notes, and snippets.

@devnullone
Last active June 17, 2022 00:50
Show Gist options
  • Save devnullone/32b7f5cc16aa2e947b1164e07c322d76 to your computer and use it in GitHub Desktop.
Save devnullone/32b7f5cc16aa2e947b1164e07c322d76 to your computer and use it in GitHub Desktop.
Dossier 3 BTS 2016 TOGO Algorithmique TOGO
#include <stdio.h>
#include <stdlib.h>
int CalculEtudiantDepart(int, int matrice[5][3]);
CalculEtudiantAge(int j, int matrice[5][3]);
int main()
{ // <20 20-25 >25
// F1 4 5 2
// F2 7 3 1
// F3 5 8 9
// F4 12 4 7
// F5 34 2 4
// Creer la matice à double entrer
int matrice[5][3];
int i, j;
int row=5;
int col=3;
for(i=0; i< row; i++){
for(j=0; j< col; j++){
printf("La Ligne: %i et la colonne %i ", i, j);
scanf("%d",&matrice[i][j]);
}
}
printf("Veuiller saisir l'id de la Faculte");
scanf("%d", &i);
printf("Le nombre d'etudiant dans la faculté %i , est: %i ",i,CalculEtudiantDepart(i, matrice));
printf("----------------------------------------------------------------------------------");
printf("Veuiller saisir l'id de la tranche d'age");
scanf("%d", &j);
printf("Le nombre d'etudiant dans cette tranche d'age (%i) , est: %i ",j ,CalculEtudiantAge(j, matrice));
/*
for(i=0, i< row, i++){
for(j=0, j< col, j++){
printf(matrice[i][j]);
}
}
*/
return 0;
}
// Fonction qui calcul le nbr etudiants par F
int CalculEtudiantDepart(int i, int matrice[5][3]){
int col=3;
int somEtudiant = 0;
for(int j=0; j<col; j++){
somEtudiant = somEtudiant + matrice[i][j];
}
return somEtudiant;
}
// Fonction qui calcul le nbr etudiants par tranche age
int CalculEtudiantAge(int j, int matrice[5][3]){
int row=5;
int somEtudiant = 0;
for(int i=0; i<row; i++){
somEtudiant = somEtudiant + matrice[i][j];
}
return somEtudiant;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment