Skip to content

Instantly share code, notes, and snippets.

@PedroHLC
Created May 27, 2016 20:56
Show Gist options
  • Save PedroHLC/2070704e696e33090c5731a32cd6516f to your computer and use it in GitHub Desktop.
Save PedroHLC/2070704e696e33090c5731a32cd6516f to your computer and use it in GitHub Desktop.
#include <stdio.h>
int main() {
int exemplo[] = {9, 8, 7, 6, 5, 4, 3, 2, 1, 0}, x, y, aux;
for(y=0; y < 9; y++) {
for(x = 0; x < 9; x++)
if(exemplo[x] > exemplo[x+1]) {
aux = exemplo[x];
exemplo[x] = exemplo[x+1];
exemplo[x+1] = aux;
}
for(x = 0; x < 10; x++)
printf("%d ", exemplo[x]);
printf("\n");
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment