Advertisement
cd62131

Shift

Jul 26th, 2014
438
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 0.49 KB | None | 0 0
  1. #include <stdio.h>
  2. int main(void) {
  3.   const int n = 5, m = 10;
  4.   int i, j, a[n][m];
  5.   for (i = 0; i < n; i++)
  6.     for (j = 0; j < m; j++)
  7.       a[i][j] = i;
  8.   puts("Before:");
  9.   for (i = 0; i < n; i++) {
  10.     for (j = 0; j < m; j++)
  11.       printf("%3d ", a[i][j]);
  12.     puts("");
  13.   }
  14.   for (i = 1; i < n; i++)
  15.     a[i - 1][m - 1] = a[i][m - 1];
  16.   puts("After:");
  17.   for (i = 0; i < n; i++) {
  18.     for (j = 0; j < m; j++)
  19.       printf("%3d ", a[i][j]);
  20.     puts("");
  21.   }
  22.   return 0;
  23. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement