Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <stdio.h>
- int main()
- {
- int pole[] = {8,4,14,10,10,6,12,18,20,16};
- int pocet_prvku = sizeof(pole)/sizeof(int);
- int i, j, PamPram;
- printf("Vypis pole: \n");
- for (i = 0; i < pocet_prvku; i++)
- {
- printf("%d ", pole[i]);
- }
- for (j= (pocet_prvku - 1); j > 0; j--)
- {
- for (i = 1; i < pocet_prvku; i++)
- {
- if (pole[i-1] > pole[i])
- {
- PamPram = pole[i];
- pole[i] = pole[i-1];
- pole[i-1] = PamPram;
- }
- }
- }
- printf("\n\nSerazene pole: \n");
- for (i = 0; i < pocet_prvku; i++)
- {
- printf("%d ", pole[i]);
- }
- getchar();
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement