Tech
Forums
Jobs
Books
Events
Videos
Live
More
Interviews
Certification
Training
Career
Members
News
Blogs
Contribute
An Article
A Blog
A Video
An Ebook
An Interview Question
Collapse
Feed
Dashboard
Wallet
Learn
Achievements
Network
Rewards
SharpGPT
Premium
Register
Login
.NET
ADO.NET
Android
ASP.NET
C#
Databases & DBA
Design Patterns & Practices
iOS
Java
OOP/OOD
SharePoint
Software Testing
Web Development
WPF
View All
1
Reply
write a C # Program add two matrix ?
rahul jaiswal
12y
13.4k
0
Reply
Submit
using System;
using System.Collections.Generic;
using System.Text;
namespace Add_Two_Matrix
{
class Program
{
static void Main(string[] args)
{
int[,] a = {{1, 2, 3 }, { 4, 5, 6 }, { 7,8,9} };
int[,] b ={ { 4, 8, 7 }, { 6,5,4}, {3,2,1 } };
int[,] c = new int[3,3];
int f = c.Length;
int i, m = 0;
int j = 0;
int n = 0;
for ( i = 0;i<3;i++)
{
Console.WriteLine(" ");
for (j = 0; j < 3; j++)
{
Console.Write(" " + a[i, j]);
}
}
Console.Write("\n");
for ( m = 0; m < 3; m++)
{
Console.WriteLine(" ");
for ( n = 0; n < 3; n++)
{
Console.Write(" " + b[m, n]);
}
}
Console.Write("\n");
for (int k = 0; k < 3; k++)
{
Console.WriteLine("");
for (int l = 0; l < 3; l++)
{
Console.Write(a[k, l] + b[k, l] + "\t");
}
}
Console.WriteLine("Yup Its Solved Its very easy welcome your all time."+"\n"+"RAK Groups");
Console.ReadLine();
}
}
}
rahul jaiswal
12y
0
Message