fork download
  1. #include <stdio.h>
  2.  
  3. int main() {
  4. int a[] = {3, 5, 2, 4, 1, 9, 7, 6, 0, 8};
  5. int temp;
  6. for (int i = 0; i < 10; i++) {
  7. printf("%d ", a[i]);
  8. }
  9. printf("\n");
  10.  
  11. temp = a[0];
  12. a[0] = a[3];
  13. a[3] = temp;
  14.  
  15. temp = a[3];
  16. a[3] = a[5];
  17. a[5] = temp;
  18.  
  19. temp = a[5];
  20. a[5] = a[8];
  21. a[8] = temp;
  22.  
  23. for (int i = 0; i < 10; i++) {
  24. printf("%d ", a[i]);
  25. }
  26. printf("\n");
  27.  
  28. return 0;
  29. }
Success #stdin #stdout 0.01s 5288KB
stdin
Standard input is empty
stdout
3 5 2 4 1 9 7 6 0 8 
4 5 2 9 1 0 7 6 3 8