Está en la página 1de 1

#include <stdio.

h>
#include <stdlib.h>

int main(){

int aux,i,j,k;
int vector[10];
int n=10;
int posiciones[10]={0,1,2,3,4,5,6,7,8,9};
int aux2=0;

for (i=0; i<n; i++){


printf("Ingrese el dato numero %d ",i);
scanf("%d",&vector[i]);
}

for (i=0;i<n;i++){
for (j=0;j<n-i-1;j++){
if (vector[j]>=vector[j+1]){

aux2=posiciones[j];
posiciones[j]=posiciones[j+1];
posiciones[j+1]=aux2;

aux=vector[j];
vector[j]=vector[j+1];
vector[j+1]=aux;
}
}
}
printf(" \n\n");
printf("ORDENADO ");
for (k=0;k<n;k++){
printf(" %-3d |",vector[k]);
}

printf(" \n");
printf("POSICIONES ");

for (k=0;k<n;k++){

printf(" %-3d |",posiciones[k]);


}

return 0;
}

También podría gustarte