In what way could I sort this code so that it would print the vector numbers incrementally?

0
    //Questão 4
#include <stdio.h>
#define TAM 10
int main()
{
    int i, valorVET, VET[TAM];
    printf("Digite os 10 numeros:\n");
    for(i = 0; i < TAM; i++)
    {
        scanf("%d", &VET[i]);
    }
    for(i = TAM - 1; i >= 0; i--)
    {
        if(i != 0)
        {
            if(VET[i] <= VET[i - 1])
            {
                valorVET = VET[i];
                VET[i] = VET[i - 1];
                VET[i - 1] = valorVET;
            }
        }
    }
    for(i = 0; i < TAM; i++)
    {
        if(i != 0)
        {
            if(VET[i] > VET[i + 1])
            {
                valorVET = VET[i];
                VET[i] = VET[i + 1];
                VET[i + 1] = valorVET;
            }
        }
    }
    printf("\n");
    for(i = 0; i < TAM; i++)
    {
        printf("%d ", VET[i]);
    }
    printf("\n\n");
    return 0;
}
    
asked by anonymous 20.04.2018 / 02:36

0 answers