-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathProgram.cs
More file actions
36 lines (31 loc) · 863 Bytes
/
Copy pathProgram.cs
File metadata and controls
36 lines (31 loc) · 863 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
Console.WriteLine("Введите количество элементов массива: ");
int size = int.Parse(Console.ReadLine());
string[] array = new string[size];
for (int i = 0; i < size; i++)
{
Console.Write("Введите элемент массива: ");
string result = Console.ReadLine();
array[i] = result;
}
Console.WriteLine(string.Join(",", array));
int count = 0;
int symbolSize = 3;
for (int i = 0; i < array.Length; i++)
{
if (array[i].Length <= symbolSize)
{
count++;
}
}
Console.WriteLine("Сформированный массив из строк с длиной не более 3 символа: ");
string[] newArray = new string[count];
int j = 0;
for (int i = 0; i < array.Length; i++)
{
if (array[i].Length <= symbolSize)
{
newArray[j] = array[i];
Console.Write(newArray[j] + ",");
j++;
}
}