I created a code that takes a certain number of numbers set by the user, and does the separation of odd and even, until I got to do it, my problem is to put the numbers in ascending order so that the code looks more beautiful visually at the time of the printing, printing in order both the odd and even. follow the code as it currently is.
#include <stdio.h>
#include <stdlib.h>
int main() {
int quantVetor = 0,vetPar[100],vetImpar[100],quantPar = 0,quantImpar = 0,posicao[100],i;
printf("Digite o tamanho do vetor que deseja\n");
scanf("%d",&quantVetor);
//
printf("Atribua os valores ao vetor\n");
for (i = 0; i < quantVetor ; i++) {
scanf("%d", &posicao[i]);
if(posicao[i] % 2 == 0){
vetPar[quantPar]=posicao[i];
quantPar++;
} else{
vetImpar[quantImpar]=posicao[i];
quantImpar++;
} // fim else
} // fim for
printf("\n\n");
for (i = 0; i < quantPar; i++) {
printf("par %d\n\n",vetPar[i] );
} // fim for
for (int i = 0; i < quantImpar; i++) {
printf("impar %d\n\n",vetImpar[i] );
} // fim for
return 0;
}
How I wish it were the output: Pairs: 2,4,6 Odds: and so on. (It does not have to be side by side but if you have to do it, I'd like to know how it is.)