Mixilino

prvi zad

Apr 9th, 2022
756
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 0.52 KB | None | 0 0
  1. #include <stdio.h>
  2. // 4 5 7 1
  3. // 5 9 6 5   -> 4 6 8 3 5 6 9 5 1 7 5 4
  4. // 3 8 6 4 23
  5.  
  6. void matUNiz(int mat[10][10], int n, int m, int niz[], int* nizn) {
  7.     *nizn = 0;
  8.     for (int i = n-1; i >=0; i--)
  9.     {
  10.         for (int j = m-1; j >= 0; j--)
  11.         {
  12.             niz[*nizn] = mat[i][j];
  13.             (*nizn)++;
  14.         }
  15.     }
  16. }
  17.  
  18. int main(void) {
  19.     int mat[10][10] = { {4,5,7,1},{5,9,6,5},{3,8,6,4} };
  20.     int n = 3, m = 4;
  21.     int niz[100];
  22.     int nizn;
  23.     matUNiz(mat, n, m, niz, &nizn);
  24.     for (int i = 0; i < nizn; i++)
  25.     {
  26.         printf("%d\t", niz[i]);
  27.     }
  28. }
  29.  
Advertisement
Add Comment
Please, Sign In to add comment