Matrix multiplication

Ddd
Posted by Ddd under C# category on | Points: 40 | Views : 2708
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Reflection;
namespace ConsoleApplication20jan
{
class cc
{
static void Main()
{
int[,] arr={{2,3},{4,5}};
int[,] arr1={{6,7},{8,9}};
int[,] mul=new int[2,2];
int i,j,k;
for(i=0;i<2;i++)
{
for(j=0;j<2;j++)
{
for(k=0;k<2;k++)
{
mul[i,j]+=arr[i,k]*arr1[k,j];
}
}
}
Console.WriteLine("the matrix multiplication");
for(i=0;i<2;i++)
{
for(j=0;j<2;j++)
{
Console.Write(mul[i,j]+"\t");
}
Console.WriteLine();
}
}
}
}

Comments or Responses

Login to post response