0% found this document useful (0 votes)
3 views3 pages

Matrix Operations in C# Code

Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
3 views3 pages

Matrix Operations in C# Code

Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd

C:\Users\USER\source\repos\ConsoleApp3\Array\Program.

cs 1
1 using System;
2 using [Link];
3 using [Link];
4 using [Link];
5 using [Link].X509Certificates;
6 using [Link];
7 using [Link];
8 using static [Link];
9
10 namespace Array
11 {
12
13 public class ArrayOperations
14 {
15
16
17 public static void MatrixMultiply(int[,] a, int[,] b)
18 {
19
20 for (int i = 0; i < [Link](0); i++)
21 {
22 for (int j = 0; j < [Link](1); j++)
23 {
24 [Link]((a[i, j] * b[i, j]) + " ");
25 }
26 [Link]();
27 }
28
29 }
30
31
32 public static void MatrixRightDiagonal(int[,] a)
33 {
34
35
36
37
38 for (int i = 0; i < [Link](0); i++)
39 {
40
41 for (int j = 0; j < [Link](1); j++)
42 {
43 if (i == j)
44 {
45 [Link]((a[i, i]) + " ");
46 }
47 else
48 {
49 [Link](0 + " ");
C:\Users\USER\source\repos\ConsoleApp3\Array\[Link] 2
50 }
51
52 }
53
54 [Link]();
55 }
56
57 }
58
59 public static void MatrixLeftDiagonal(int[,] a)
60 {
61
62
63
64
65 for (int i = 0; i < [Link](0); i++)
66 {
67
68 for (int j = 0; j < [Link](1); j++)
69 {
70 if (i + j == [Link](1) - 1)
71 {
72 [Link]((a[i, j]) + " ");
73 }
74 else
75 {
76 [Link](0 + " ");
77 }
78
79 }
80
81 [Link]();
82 }
83
84 }
85
86
87 }
88
89
90 public class Program
91 {
92 public static void Main()
93 {
94
95
96 int[,] b = new int[3, 3]
97 {
98 { 1, 2, 3 },
C:\Users\USER\source\repos\ConsoleApp3\Array\[Link] 3
99 { 4, 5, 6 },
100 { 7, 8, 9 }
101 };
102
103 int[,] c = new int[3, 3]
104 {
105 { 1, 2, 3 },
106 { 4, 5, 6 },
107 { 7, 8, 9 }
108 };
109
110
111 [Link](b, c);
112 [Link]("\n");
113 [Link](b);
114 [Link]("\n");
115 [Link](b);
116
117
118
119 }
120 }
121
122
123
124 }

You might also like