-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathProgram.cs
More file actions
30 lines (25 loc) · 763 Bytes
/
Program.cs
File metadata and controls
30 lines (25 loc) · 763 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
string[] words(string[] array)
{
string[] NewWords = new string[11];
int count = 0;
for (int i = 0; i < array.Length; i++)
{
if (array[i].Length <= 3)
{
NewWords[count] = array[i];
count++;
}
}
Array.Resize(ref NewWords, count);
return NewWords;
}
void Print(string[] array)
{
Console.Write("[" + string.Join(", ", array) + "]");
Console.WriteLine();
}
string[] NewArray = { "hello", "2", "world", ":-)", "1234", "1567", "-2", "computer science", "Russia", "Denmark", "Kazan" };
Console.Write("Заданный массив: ");
Print(NewArray);
Console.Write("Элементы массива меньше либо равно 3 символов: ");
Print(words(NewArray));