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 44
| #include<stdio.h>
#include<conio.h>
void main ()
{
int n=3,cpt, m=2,note[2], t[3],moy[3],i,j,s,temp;
clrscr();
printf("Donner les codes etudiant et les notes\n");
for(i=0;i<n;i++)
{
printf("\ncode %d: ",i+1);
scanf("%d",&t[i]);
j=0; s=0;
do
{
printf("dommerla %d ieme note :",i);
scanf("%d",¬e[j]);
s=s+note[j];
j++;
}
while(j<m);
cpt=j;
moy[i]=(s/cpt);
printf("\nLa moyenne de %d est %d: ",t[i],moy[i]);
printf("\n");
}
for(i=0;i<(n-1);i++)
{
for(j=1;j<n;j++)
{
if(moy[i]<moy[j])
{
temp=moy[i];
moy[i]=moy[j];
moy[j]=temp;
}
}
}
for(i=0;i<n;i++)
{
printf("\nletudiant %d: \n",t[i]);
printf("de est %d avec une moyenne de %d",i+1,moy[i]);
}
getch();
} |
Partager