Find matrix of two dimensional arrays
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace ConsoleApplication25
{
class Program
{
static void Main(string[] args)
{
int i, j;
int[,] a1 = new int[3, 3];
int[,] a2 = new int[3, 3];
int[,] a3 = new int[3, 3];
Console.WriteLine("enter the
first array values:");
for (i = 0; i < 3; i++)
{
for (j = 0; j < 3; j++)
{
a1[i, j] = Convert.ToInt32(Console.ReadLine());
}
}
Console.WriteLine("enter the
second array values:");
for (i = 0; i < 3; i++)
{
for (j = 0; j < 3; j++)
{
a2[i, j] = Convert.ToInt32(Console.ReadLine());
}
}
Console.WriteLine("matrix of
two dimensional array:");
for (i = 0; i < 3; i++)
{
for (j = 0; j < 3; j++)
{
for (int k = 0; k < 3; k++)
a3[i, j] = a3[i, j] +
a1[i, k] * a2[k, j];
}
}
for (i = 0; i < 3; i++)
{
for (j = 0; j < 3; j++)
{
Console.Write(" " + (a3[i, j]));
}
Console.WriteLine();
}
Console.ReadLine();
}
}
}
https://www.youtube.com/channel/UCKLRUr6U5OFeu7FLOpQ-FSw/videos
0 comments
Post a Comment