Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <stdio.h>
- #include <stdlib.h>
- int pom[10];
- int cmpfunc(const void * a, const void * b) {
- return ((int)a - (int)b);
- }
- int main()
- {
- int n, a[10][1000];
- while (scanf("%d", &n) == 1)
- {
- int temp;
- temp = n / 10;
- a[temp][pom[temp]] = n % 10;
- pom[temp]++;
- }
- //sort
- for (int i = 0; i < 10; i++)
- qsort(a[i], pom[i], sizeof(int), cmpfunc);
- //vypis
- for (int i = 0; i < 10; i++)
- {
- if (pom[i] > 0)
- {
- printf("%d | ", i);
- for (int j = 0; j < pom[i]; j++)
- printf("%d", a[i][j]);
- printf("\n");
- }
- }
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement