Advertisement
BoneFort

Untitled

Jan 31st, 2023 (edited)
301
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 0.90 KB | Gaming | 0 0
  1. void OutputMatrix(double* massive, double** _matrix, int rows_count, int columns_count)
  2. {
  3.     int massive_count = 0;
  4.     for (int i = 0; i < rows_count; i++)
  5.     {
  6.         for (int j = 0; j <= columns_count; j++)
  7.         {
  8.             if(j == columns_count)
  9.             {
  10.                 for(int k = 0; k < rows_count; k++)
  11.                 {
  12.                     (*_matrix)[(((i + 1) + k) * columns_count) + (j - i)] = massive[massive_count];
  13.                     massive_count++;
  14.                 }
  15.             }
  16.             else
  17.             {
  18.                 (*_matrix)[(i * columns_count) + (j - i)] = massive[massive_count];
  19.                 massive_count++;
  20.             }        
  21.         }  
  22.     }
  23.    
  24.     putchar('\n');
  25.     putchar('\n');
  26.     for (int i = 0; i < rows_count; i++)
  27.     {
  28.         for (int j = 0; j < columns_count; j++)
  29.             printf("%.2f ", (*_matrix)[i * columns_count + j]);
  30.         putchar('\n');
  31.     }
  32. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement