Advertisement
Guest User

text

a guest
Feb 26th, 2017
76
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 0.74 KB | None | 0 0
  1. int scanMatrix(int matrix[][], int lines, int columns)
  2. {
  3.  int i,j;
  4.  for(i = 0 ; i < lines ; i++)
  5.  {
  6.   for(j = 0 ; j < columns ; j++)
  7.   {
  8.    printf("Matrix[%d][%d] = ", i, j);
  9.    scanf("%d", &matrix[i][j]);
  10.   }
  11.  }
  12.  return ;
  13. }
  14.  
  15. int printMatrix(int matrix[][], int lines, int columns)
  16. {
  17.  int i,j;
  18.  for(i = 0 ; i < lines ; i++)
  19.  {
  20.   for(j = 0 ; j < columns ; j++)
  21.   {
  22.    printf("%d   ", matrix[i][j]);
  23.   }
  24.   printf("\n");
  25.  }
  26.  return ;
  27. }
  28.  
  29.  
  30. int main()
  31. {
  32.  int matrice[20][20];
  33.  int lignes, colonnes;
  34.  printf("Introduisez le nombre de lignes puis le nombre de colonnes \n");
  35.  scanf("%d", &lignes);
  36.  scanf("%d", &colonnes);
  37.  scanMatrix(matrice, lignes, colonnes);
  38.  printMatrix(matrice, lignes, colonnes);
  39.  
  40.  
  41.  return 0;
  42. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement