All pastes #744503 Raw Edit

Unnamed

public text v1 · immutable
·published 2007-10-21 15:35 UTC
rendered paste body
#include <stdio.h>
#include <stdlib.h>
#include <windows.h>
void color(int ct, int cf);

int main()
{
    int nb_note, note_ind=1;
    float tab[note_ind], somme=0, moy=0;
    color (10,0);
    printf("ce programme va calculer la moyenne d'un eleve\n");
    printf("nombre de note a saisir?\n");
    color(12,0);
    scanf("%d",&nb_note);
    do
    {
          color (10,0);             
          printf("n(%d)",note_ind);
          color (12,0);
          scanf("%f",&tab[note_ind]);
          somme = somme + tab[note_ind];
          note_ind++;              
    }
    while (note_ind<nb_note+1);
    moy = somme / nb_note;
    color (15,0);
    printf("la moyenne de l'eleve est %0.2f\n",moy);

system("PAUSE");
return 0;
}
void color(int ct, int cf)
{
     HANDLE H=GetStdHandle(STD_OUTPUT_HANDLE);
     SetConsoleTextAttribute(H,cf*16+ct);
}