write a program to print any matrix in c

Solutions on MaxInterview for write a program to print any matrix in c by the best coders in the world

showing results for - "write a program to print any matrix in c"
Ayden
05 Jul 2018
1void printMatrice(matrice) {
2    int x = 0;
3    int y = 0;
4
5    for(x = 0 ; x < numberOfLines ; x++) {
6        printf(" (");
7        for(y = 0 ; y < numberOfColumns ; y++){
8            printf("%d     ", matrix[x][y]);
9        }
10        printf(")\n");
11    }
12}
13
Laura
17 Sep 2017
1#include <stdio.h>
2int main()
3{
4    int i, j, m, n;
5    int matrix[10][10];
6
7    printf("Enter number of rows : ");
8    scanf("%d", &m);
9    printf("Enter number of columns : ");
10    scanf("%d", &n);
11
12
13    for (i = 0; i < m; i++)
14    {
15        for (j = 0; j < n; j++)
16        {
17            printf("Enter matrix element [%d][%d]: ", i, j);
18            scanf("%d", &matrix[i][j]);
19        }
20    }
21
22
23    for (i = 0; i < m; i++)
24    {
25        for (j = 0; j < n; j++)
26        {
27            printf("%d\t", matrix[i][j]);
28        }
29        printf("\n");
30    }
31}
32