Advertisement
Guest User

Untitled

a guest
Apr 26th, 2015
205
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.01 KB | None | 0 0
  1. #include <stdio.h>
  2.  
  3. int matrix[10][10] = {
  4. { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9 },
  5. { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9 },
  6. { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9 },
  7. { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9 },
  8. { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9 },
  9. { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9 },
  10. { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9 },
  11. { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9 },
  12. { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9 },
  13. { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9 },
  14. };
  15.  
  16. int main(int argc, char *argv[])
  17. {
  18. int y, x;
  19.  
  20. for (y = 0; y < 10; y++) {
  21. for (x = 0; x < 10; x++) {
  22. printf("%d ", matrix[y][x]);
  23. }
  24. printf("\n");
  25. }
  26.  
  27. for (y = 0; y < 10; y++) {
  28. for (x = 0; x < 10; x++) {
  29. int x1 = x * (0) - y * (-1);
  30. int y1 = x * (1) + y * ( 0);
  31.  
  32. matrix[y1][x1] |= (matrix[y][x] & 15) << 4;
  33. }
  34. }
  35.  
  36. printf("\n");
  37.  
  38. for (y = 0; y < 10; y++) {
  39. for (x = 0; x < 10; x++) {
  40. printf("%d ", matrix[y][x] >> 4);
  41. }
  42. printf("\n");
  43. }
  44. return 0;
  45. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement