Advertisement
kekellner

Espejar arreglos

Apr 23rd, 2021
1,070
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 0.83 KB | None | 0 0
  1. /******************************************************************************
  2.  
  3. Welcome to GDB Online.
  4. GDB online is an online compiler and debugger tool for C, C++, Python, PHP, Ruby,
  5. C#, VB, Perl, Swift, Prolog, Javascript, Pascal, HTML, CSS, JS
  6. Code, Compile, Run and Debug online from anywhere in world.
  7.  
  8. *******************************************************************************/
  9. #include <stdio.h>
  10.  
  11. int arr[25] = {1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25};
  12.  
  13. int arr1[5];
  14. int arr2[5];
  15.  
  16. int main()
  17. {
  18.     for (int i = 0; i < 5; i ++){
  19.         arr1[i] = arr[i];
  20.         arr2[i] = arr[20 + i];
  21.     }
  22.     for (int i = 0; i < 5; i ++){
  23.         arr[i] = arr2[i];
  24.         arr[20 + i] = arr1[i];
  25.     }
  26.    
  27.     for (int i = 0; i < 25 ; i++)
  28.         printf("%d ", arr[i]);
  29.     return 0;
  30. }
  31.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement