-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathProgram.cs
More file actions
60 lines (47 loc) · 966 Bytes
/
Program.cs
File metadata and controls
60 lines (47 loc) · 966 Bytes
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
46
47
48
49
50
51
52
53
54
55
56
int GetArraySize()
{
Console.WriteLine("Введите количество элементов массива: ");
int Size = Convert.ToInt32(Console.ReadLine());
return Size;
}
int[] FirstArray(int Size)
{
return new int[Size];
}
int[] FillArray(int[] Arr)
{
int index = 0;
int lenght = Arr.Length;
while (index < lenght)
{
Arr[index] = Random.Shared.Next(1, 10);
Console.Write($"{Arr[index]} ");
index++;
}
Console.WriteLine();
return Arr;
}
int[] GetProd(int[] Array)
{
int[] ArrRez = new int[Array.Length / 2];
int count = Array.Length;
for (int i = 0; i < count / 2; i++)
{
ArrRez[i] = Array[i] * Array[count - 1 - i];
}
return ArrRez;
}
void PrintArray(int[] Array)
{
int count = Array.Length;
for (int i = 0; i < count; i++)
{
Console.Write($"{Array[i]} ");
}
}
int Size = GetArraySize();
int[] Arr = FirstArray(Size);
FillArray(Arr);
int[] ArrRez = GetProd(Arr);
PrintArray(ArrRez);