-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtask01.cs
More file actions
45 lines (35 loc) · 1.03 KB
/
Copy pathtask01.cs
File metadata and controls
45 lines (35 loc) · 1.03 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
// Задача 47. Задайте двумерный массив размером m×n, заполненный
// случайными вещественными числами.
// m = 3, n = 4.
// 0,5 7 -2 -0,2
// 1 -3,3 8 -9,9
// 8 7,8 -7,1 9
Console.Write("Enter num column matrix: ");
int n = Convert.ToInt32(Console.ReadLine());
Console.Write("Enter num lines matrix: ");
int m = Convert.ToInt32(Console.ReadLine());
void Matrix (double[,] matr)
{
for (int i = 0; i < matr.GetLength(0); i++)
{
for (int j = 0; j < matr.GetLength(1); j++)
{
matr[i, j] = new Random().NextDouble() * 1000;
}
}
}
void PrintMatrix(double[,] matr)
{
for (int i = 0; i < matr.GetLength(0); i++)
{
for (int j = 0; j < matr.GetLength(1); j++)
{
Console.Write($"{matr[i, j]} ");
}
Console.WriteLine();
}
}
double[,] matrix = new double [m , n];
Console.WriteLine($"Matrix: ");
Matrix(matrix);
PrintMatrix(matrix);