bonjour,

Je voudrais afficher une matrice. J'ai utilisé un tableau à deux dimensions.
Voici le programme que j'ai fait:

Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
 
 
#include<stdio.h>
 
main()
{
 
  int i;
  int j;
  int tab[2][3]={{1,2,5},{8,7,6}};
  int N;
  N=2;
  int M;
  M=3;
  for(i=0;i<N;i++)
  {
    for(j=0;j<M;j++)
    {    
      printf("[%d]",tab[i][j]); 
 
    } 
 
  }   
getchar();
}
Lorsque je compile celà marche mais ca m'affichie tout en ligne.
Alors je boudrais qu'il m'affiche la matrice avec 2 lignes et 3 colonnes.
Je n'arrive pas à résoudre mon problème.
Quelqu'un pourrait m'aider??