fork download
  1. #include <cstdio>
  2. using namespace std;
  3.  
  4. int main() {
  5. // your code goes here
  6. const int size = 5;
  7. int arr[size][size] = {
  8. {1,2,3,4,5},
  9. {2,2,3,4,5},
  10. {3,2,3,4,5},
  11. {4,2,3,4,5},
  12. {5,2,3,4,5}
  13. };
  14.  
  15. for(int i = 0; i < size;i++)
  16. {
  17. for(int j = 0; j < size;j++)
  18. {
  19. printf("%d ",arr[i][j]);
  20. }
  21. printf("\n");
  22. }
  23.  
  24. for(int i = 0; i <size-1;i++)
  25. {
  26. int t = arr[i][0];
  27. arr[i][0] = arr[size-1][0];
  28. arr[size-1][0] = t;
  29. }
  30.  
  31. printf("\n");
  32. for(int i = 0; i < size;i++)
  33. {
  34. for(int j = 0; j < size;j++)
  35. {
  36. printf("%d ",arr[i][j]);
  37. }
  38. printf("\n");
  39. }
  40. }
Success #stdin #stdout 0s 16048KB
stdin
Standard input is empty
stdout
1 2 3 4 5 
2 2 3 4 5 
3 2 3 4 5 
4 2 3 4 5 
5 2 3 4 5 

5 2 3 4 5 
1 2 3 4 5 
2 2 3 4 5 
3 2 3 4 5 
4 2 3 4 5