fork download
  1. #include <stdio.h>
  2.  
  3.  
  4. int main(void)
  5. {
  6. int arr[4][4];
  7. int arr1[4][4];
  8. int i,j;
  9. int k = 1;
  10.  
  11.  
  12. for(i=0; i<4; i++)
  13. for(j=0; j<4; j++)
  14. arr[i][j] = k++;
  15.  
  16. for(j=0; j<4; j++)
  17. {
  18. arr1[j][3] = arr[0][j];
  19. arr1[j][2] = arr[1][j];
  20. arr1[j][1] = arr[2][j];
  21. arr1[j][0] = arr[3][j];
  22. }
  23.  
  24. for(i=0; i<4; i++)
  25. {
  26. for(j=0; j<4; j++)
  27. printf("%4d",arr[i][j]);
  28. printf("\n");
  29. }
  30.  
  31. for(i=0; i<4; i++)
  32. {
  33. for(j=0; j<4; j++)
  34. printf("%4d",arr1[i][j]);
  35. printf("\n");
  36. }
  37. }
  38.  
Runtime error #stdin #stdout 0s 1832KB
stdin
Standard input is empty
stdout
   1   2   3   4
   5   6   7   8
   9  10  11  12
  13  14  15  16
  13   9   5   1
  14  10   6   2
  15  11   7   3
  16  12   8   4