Advertisement
Josif_tepe

Untitled

Jun 12th, 2021
120
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 0.76 KB | None | 0 0
  1. #include <stdio.h>
  2. #include <ctype.h>
  3. #include <string.h>
  4. #include <math.h>
  5.  
  6.  
  7. int main(int argc, char *argv[]) {
  8.     int n, m;
  9.     scanf("%d%d", &n, &m);
  10.    
  11.     int matrica[n][m];
  12.     for(int i = 0; i < n; i++) {
  13.         for(int j = 0; j < m; j++) {
  14.             scanf("%d", &matrica[i][j]);
  15.         }
  16.     }
  17.     for(int i = 0; i < n; i += 2) {
  18.         for(int j = 0; j < m; j++) {
  19.             if(i + 1 < n) {
  20.                 matrica[i][j] -= matrica[i + 1][j];
  21.             }
  22.         }
  23.     }
  24.     for(int i = 0; i < n; i += 2) {
  25.         for(int j = 0; j < m; j++) {
  26.             printf("%d ", matrica[i][j]);
  27.         }
  28.         printf("\n");
  29.     }
  30.     return 0;
  31. }
  32. /*
  33.  1 0 2 4
  34.  3 3 23 5
  35.  3 5 5 6
  36.  0 3 12 7
  37.  1 7 0 12
  38.  3 3 4 3
  39.  
  40.  
  41.  
  42.  1 7
  43.  **/
  44.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement