Использование Random при работе с массивами - C#
Формулировка задачи:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace ConsoleApplication27
{
class Program
{
static void Main()
{
const int m=3,n=3;
int [,] a= new int[m,n]
{
{1,1,1},
{0,0,0},
{3,3,3}
};
int [,] b= new int[m,n]
{
{1,2,3},
{4,5,6},
{7,8,9}
};
int [,] c= new int[m,n];
Console.WriteLine("Исходный массив a: ");
for (int i=0;i<m;++i)
{
for (int j=0;j<n;++j)
Console.Write("\t" +a[i,j]);
Console.WriteLine();
}
Console.WriteLine("Исходный массив b: ");
for (int i=0;i<m;++i)
{
for (int j=0;j<n;++j)
Console.Write("\t" +b[i,j]);
Console.WriteLine();
}
for(int i = 0; i < m; ++i)
for(int j = 0; j < n; ++j)
{
int s=0;
for(int k = 0; k < n;++k)
s+= a[i,k]*b[k,j];
c[i,j] = s;
}
Console.WriteLine("Полученное произведение матриц : ");
for (int i=0;i<m;++i)
{
for (int j=0;j<n;++j)
Console.Write("\t" + c[i,j]);
Console.WriteLine();
Console.ReadKey();
}
}
}
}
Простите но у меня не получается правельно написать тут код
мне надо чтоб помогли написать при помощи Randoma цифр и цикла Array
Решение задачи: «Использование Random при работе с массивами»
textual
Листинг программы
{
const int m=3,n=3;
int [,] a= new int[m,n]
{
{1,1,1},
{0,0,0},
{3,3,3}
};
int [,] b= new int[m,n]
{
{1,2,3},
{4,5,6},
{7,8,9}
};