Advertisement
leo1553

Troca

Nov 18th, 2017
134
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 0.38 KB | None | 0 0
  1. #include <sdtio.h>
  2.  
  3. int main()
  4. {
  5.     int vet[10];
  6.     int i;
  7.     for(i = 0; i < 10; i++)
  8.     {
  9.         printf("Insira o valor o valor de vet[%d]: ", i);
  10.         scanf("%d", &vet[i]);
  11.     }
  12.    
  13.     int temp;
  14.     for(i = 0; i < 5; i++)
  15.     {
  16.         temp = vet[i];
  17.         vet[i] = vet[9 - i];
  18.         vet[9 - i] = temp;
  19.     }
  20.  
  21.     for(i = 0; i < 10; i++)
  22.     {
  23.         printf("Valor de vet[%d] = %d\n", i, vet[i]);
  24.     }
  25.     return 0;
  26. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement