1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43
   |  
#include <stdio.h>
 
float moyenne(float tab_nt[], int nbNt)
{
  int i;
  float moy;
  float som=0;
  for (i=0; i<nbNt; i++)
    som=som+tab_nt[i];
  moy=som/nbNt;
  return moy;
}
 
int insuf(float tab_nt[], float moy, int nbNt)
{
  int i;
  int som=0;
  for (i=0; i<nbNt; i++)
    if (tab_nt[i]<moy)
      som=som+1;
  return som;
 
int main()
{
  float moy;
  int nbNt,i;
  printf("Combien de note seron incerer : ");
  scanf ("%d",&nbNt);
  float tab_nt[nbNt];
  printf("\nQuelle sera la moyenne : ");
  scanf ("%f",&moy);
  float moy_el=0;
  int nt_insuf=0;
  for (i=0; i<nbNt; i++)
    {
      printf("La %d note : ", i+1);
      scanf ("%f",&tab_nt[i]);
    }
  moy_el=moyenne(tab_nt,nbNt);
  nt_insuf=insuf(tab_nt,nbNt,moy);
  printf ("\nLa moyenne et de %.3f avec %d note dessou d'une moyenne de %f\n",moy_el, nt_insuf, moy);
} | 
Partager