Created
April 18, 2015 19:01
-
-
Save shohan4556/829e34ad59a089ff112d to your computer and use it in GitHub Desktop.
age sort - 11426 solution in C
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/// 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