1//de menor a mayor
2void ordenar(int v[], int size){
3 int i, j, aux;
4
5 //ALGORITMO DE BURBUJA
6 for (i = 0; i < size - 1; i++){
7 for (j = i + 1; j < size; j++){
8 if(v[i] > v[j]){
9 aux = v[i];
10 v[i] = v[j];
11 v[j] = aux;
12 }
13 }
14 }
15
16 printf("\n");
17 for(int i = 0; i <= size - 1; i++){
18 printf("vector[%d]: %d\n", i, v[i]);
19 }
20}
21
22//de mayor a menor
23void ordenar_mayor_menor(int *v, int tam){
24 int i, j, aux;
25
26 for(i = 1; i < tam; i++){
27 for(j = tam - 1; j >= i; j--){
28 if(v[j] > v[j-1]){
29 aux = v[j];
30 v[j] = v[j-1];
31 v[j-1] = aux;
32 }
33 }
34 }
35}