Matrix display in C

Solved
Hello,

Here is the translation of the provided text into English:

Hello,

I’m programming in C under Dev-C++ and I’d like to display a tabulated matrix in proper form. For example I want to display: matrix[2][3] = {{1,3,8},{5,6,9}}.

I write:
for(i=0,i++,i<2) for(j=0,j++,j<3){ printf("%d /t",matrix[i][j]); }

I get displayed: 1 3 8 5 6 9

What I want to display is: 1 3 8 on one line and 5 6 9 on the following line.

How to do? I’m counting on your precious help..thanks in advance :)

Configuration: Windows Vista
Safari 532.0

4 answers

  1. #define m 2
    #define n 3
    main()
    {
    int tab [m][n]= {{1,2,3},{4,5,6}};
    int i,j;
    for(i=0; i<m; i++)

    {
    for(j=0; j<n; j++)
    {
    printf("%d",tab[i][j]);
    printf(j<n-1?"\t":"\n");
    }
    }
    }
    7
    1. I didn’t understand that:
      printf(j<n-1?"\t":"\n");
      and thanks
      0
    2. @abdelali_1119Hello, this is an if then else in one line
       if?then:else j<n-1?"\t":"\n" 
      0