Skip to content

Commit 9d42195

Browse files
authored
Merge pull request #1290 from i-archit-gupta/master
Create Matrix Maker.c
2 parents 5c13387 + a5d0018 commit 9d42195

File tree

1 file changed

+49
-0
lines changed

1 file changed

+49
-0
lines changed

07. Matrix/Matrix Maker.c

+49
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
#include <stdio.h>
2+
//Program used to make a 3X3 matrix using 2-D Array.
3+
int main()
4+
{
5+
int matrix[3][3];
6+
int i,j;
7+
printf("This program will print a 3X3 matrix:\n\n");
8+
for ( i = 0; i <= 2; i++)
9+
{
10+
for ( j = 0; j <= 2; j++)
11+
{
12+
printf("Enter the numbers row wise:");
13+
scanf("%d",&matrix[i][j]);
14+
}
15+
}
16+
printf("\n\n\n");
17+
for ( i = 0; i < 3; i++)
18+
{
19+
for ( j = 0; j < 3; j++)
20+
{
21+
printf("%d\t",matrix[i][j]);
22+
}
23+
printf("\n");
24+
}
25+
printf("\n\nSo this is the matrix form of numbers or also known as 2-D array.");
26+
return 0;
27+
}
28+
29+
//Output:
30+
// This program will print a 3X3 matrix:
31+
32+
// Enter the numbers row wise:1
33+
// Enter the numbers row wise:2
34+
// Enter the numbers row wise:3
35+
// Enter the numbers row wise:4
36+
// Enter the numbers row wise:5
37+
// Enter the numbers row wise:6
38+
// Enter the numbers row wise:7
39+
// Enter the numbers row wise:8
40+
// Enter the numbers row wise:9
41+
42+
43+
44+
// 1 2 3
45+
// 4 5 6
46+
// 7 8 9
47+
48+
49+
// So this is the matrix form of numbers or also known as 2-D array.

0 commit comments

Comments
 (0)