Good afternoon, I'm having a problem with a vector ordering exercise, I have already reviewed the code, it compiles, but I'm not finding the error for the order not to stay increasing, varying in certain passages. Here is the code:
#include <stdio.h> //Declaracao de bibliteca para entradas e saidas de valores
int main (void) //Declaracao do programa principal
{
int i, j, troca, vetorA[10];
for (i = 0; i < 10 ; i++)
{
printf("Digite o valor do elemento:");
scanf("%d", &vetorA[i]);
}
for(i=0; j<10; i++)
{
for (j=i+1; j<10; j++)
{
if(vetorA[i]>vetorA[j])
{
troca=vetorA[i];
vetorA[i] = vetorA[j];
vetorA[j] = troca;
}
}
}
printf("\nvetor ordenado \n");
for(i=0; i<10; i++)
{
printf("%d - ", vetorA[i]);
}
system("pause");
return 0;
}