#include <stdio.h>
#include <stdlib.h>
int grades[104] ;
int compare (const void * a, const void * b)
{
return ( *(int*)a - *(int*)b );
}
int main ()
{
int n;
for(int i=0;i<10;i++){
printf("Enter grade %d: ",(i+1));
scanf("%d",&grades[i]);
}
qsort (grades, 10, sizeof(int), compare);
for (n=9; n>=0; n--)
printf ("%d ",grades[n]);
scanf("%d",&grades[0]);
return 0;
}
Comments
Leave a comment