File tree 1 file changed +49
-0
lines changed
1 file changed +49
-0
lines changed Original file line number Diff line number Diff line change
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.
You can’t perform that action at this time.
0 commit comments