Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include<stdio.h>
- int main(void) {
- int collection[20] = {10,16,12,5,1,8,15,7,6,17,2,4,19,14,9,18,11,3,13,0};
- int z = 19;//Array max.
- int i = 0;//outside counter
- int j = 0;//inside counter
- int circle;//circlechange var.
- int printcount;//printcounter for array output
- for (i=0; i<=z; i++) {
- for (j=z; z-1<=i; j--) {
- if (collection[j] < collection[j - 1]) {
- circle = collection[j];
- collection[j] = collection[j - 1];
- collection[j - 1] = circle;
- }
- }
- for (printcount = 0; printcount <= 19; printcount++) {
- printf("%d ", collection[printcount]);
- }
- printf("\n");
- }
- getch();
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement