-1
I fed the array with the user input, but the algorithm doesn’t give the output in an orderly way, which I did wrong?
int main()
{
// variáveis
int vetor[5] = {0};
int aux, i=0, j=0;
printf("Entre com numeros\n\n");
// input
for(int i=0;i<5;i++){
scanf("%i", & vetor[i]);
}
//Ordenação
for(i=0;i<5;i++){
for(int j=0;j<(5-1);j++){
if(vetor[j] > vetor[j++]){
aux = vetor[j];
vetor[j] = vetor[j++];
vetor[j++] = aux;
}
}
}
//Output
for(int i=0;i<5;i++){
printf("%i\t",vetor[i]);
}
return 0;
}