Skip to content

Instantly share code, notes, and snippets.

@shohan4556
Created April 18, 2015 19:01
Show Gist options
  • Save shohan4556/829e34ad59a089ff112d to your computer and use it in GitHub Desktop.
Save shohan4556/829e34ad59a089ff112d to your computer and use it in GitHub Desktop.
age sort - 11426 solution in C
/// Author : Shohan
// Uva : 11462
#include<stdio.h>
#include<stdlib.h>
int compair(const void *i, const void *j);
int main()
{
int i,n;
while(scanf("%d",&n)==1){
int num[n];
if(n==0)
break;
for(i=0;i<n;i++){
scanf("%d",&num[i]);
}
qsort(num,n,sizeof(int),compair);
for(i=0;i<n-1;i++)
printf("%d ",num[i]);
printf("%d",num[n-1]);
printf("\n");
}
return 0;
}
int compair(const void *i, const void *j)
{
return *(int *)i - *(int *)j;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment