-5
This is my code:
#include <stdio.h>
#include <stdlib.h>
#include <locale.h>
#include <unistd.h>
#define tam 20
int main (void){
setlocale(LC_CTYPE, "");
int num[tam];
int troca[tam];
for(int i = 0; i < tam; i ++){
printf("\n\tDigite aqui o %dº número >==> ", i+1);
scanf("%d", &num[i]);
}
for(int i = 0; i < tam; i ++){
if(i == 10){
printf("\n");
}
troca[0]=num[1];
troca[2]=num[3];
troca[4]=num[5];
troca[6]=num[7];
troca[8]=num[9];
troca[10]=num[11];
troca[12]=num[13];
troca[14]=num[15];
troca[16]=num[17];
troca[18]=num[19];
troca[19]=num[18];
troca[17]=num[16];
troca[15]=num[14];
troca[13]=num[12];
troca[11]=num[10];
troca[9]=num[8];
troca[7]=num[6];
troca[5]=num[4];
troca[3]=num[2];
troca[1]=num[0];
sleep(1);
printf("\t%d", troca[i]);
}
return 0;
system("pause");
}
You could explain better what you want to do, only the title of the question does not clarify enough.
– Flávio Granato
There is, but explain better what your need is by editing the question.
– Woss
So I drew a 20 position vector, right after that I had to invert the vector values in the following way. the first value with the second, the third with the fourth, the fifth with the sixth and so on until the exchange of the nineteenth with the twentieth.
– fvsgamers