Skip to content

Instantly share code, notes, and snippets.

@LinuxDoku
Created May 14, 2013 21:12
Show Gist options
  • Save LinuxDoku/5579589 to your computer and use it in GitHub Desktop.
Save LinuxDoku/5579589 to your computer and use it in GitHub Desktop.
#include <stdio.h>
void main() {
int i, z;
int arr[5] = {6, 7, 1, 3, 2};
for(i = 5; i >= 0; i--) {
for(z = 0; z < i - 1; z++) {
if(arr[z] > arr[z + 1]) {
int tmp = arr[z];
arr[z] = arr[z + 1];
arr[z + 1] = tmp;
}
}
}
for(i = 0; i < 5; i++)
printf("%d ", arr[i]);
printf("\n");
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment