/* Implementación del algoritmo de ordenación de la burbuja empleando bucles while Pedro J. Lledó */ #include int main () { int j; int i; int tmp; int v[10]={2,4,5,3,1,6,7,8,10,9}; puts("el vector inicial: "); i=0; while (i<10) { printf("%i ",v[i]); i++; } printf("\n"); i=0; while (i<10) { j=i+1; while (j<10) { if (v[i]>v[j]) { tmp=v[i]; v[i]=v[j]; v[j]=tmp; } j++; } i++; } puts("El vector ordenado: "); i=0; while (i<10) { printf("%i ",v[i]); i++; } printf("\n"); return 1; }