Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- class Program
- {
- static void Main(string[] args)
- {
- int[,] a = new int[10,10];
- int[,] b = new int[10,10];
- int[,] c = new int[10,10];
- int m, n;
- Console.WriteLine("Enter the Number of rows and coulmns of Matrix A and B");
- m = Convert.ToInt16(Console.ReadLine());
- n = Convert.ToInt16(Console.ReadLine());
- //Getting The Values of Matrix A
- Console.WriteLine("Enter the values of Matrix A");
- for (int i = 0; i < m; i++)
- {
- for (int j = 0; j < n; j++)
- {
- a[i, j] = Convert.ToInt16(Console.ReadLine());
- }
- }
- //Getting The Values of Matrix B
- Console.WriteLine("Enter the values of Matrix B");
- for (int i = 0; i < m; i++)
- {
- for (int j = 0; j < n; j++)
- {
- b[i, j] = Convert.ToInt16(Console.ReadLine());
- }
- }
- //Printing Matrix A
- Console.WriteLine("Matrix A");
- for (int i = 0; i < m; i++)
- {
- for (int j = 0; j < n; j++)
- {
- Console.Write(a[i, j] + "\t");
- }
- Console.WriteLine();
- }
- Console.WriteLine("Matrix B");
- //Printing Matrix B
- for (int i = 0; i < m; i++)
- {
- for (int j = 0; j < n; j++)
- {
- Console.Write(b[i,j] + "\t");
- }
- Console.WriteLine();
- }
- //Addition Of Matrix
- Console.WriteLine("Addition Of Matrix");
- for (int i = 0; i < m; i++)
- {
- for (int j = 0; j < n; j++)
- {
- c[i, j] = a[i, j] + b[i, j];
- Console.Write(c[i,j] + "\t");
- }
- Console.WriteLine("\n");
- }
- }
- }
Add Comment
Please, Sign In to add comment