Attachment '23.0.3.c'

Download

   1 #include <stdio.h>
   2 #include <stdlib.h>
   3 int main (int argc, char** argv )
   4 {
   5     int *m; // our matrix
   6     int n; // matrix size (square)
   7     int i, j;
   8     
   9     scanf( "%d\n", &n );
  10     
  11     m = malloc( n * n * sizeof(int) );
  12     
  13     for( j = 0; j < n; j ++ ) { // строка 0..n-1
  14       for ( i = 0; i < n; i ++ ) // столбец 0..n-1
  15         scanf( "%d", (m + j*n + i) ); 
  16     }
  17     
  18     printf( "your matrix: \n" );
  19     for( j = 0; j < n; j ++ ) { // строка 0..n-1
  20       for ( i = 0; i < n; i ++ ) // столбец 0..n-1
  21         printf( "%3d ", *(m + j*n + i) );
  22       printf( "\n" );
  23     }
  24         
  25     
  26     /*
  27     for( i = 0; i < n*n; i++ )
  28       scanf("%d
  29     */
  30     
  31     
  32     return 0;
  33 }

Attached Files

To refer to attachments on a page, use attachment:filename, as shown below in the list of files. Do NOT use the URL of the [get] link, since this is subject to change and can break easily.

You are not allowed to attach a file to this page.