-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathControl.cs
More file actions
39 lines (38 loc) · 875 Bytes
/
Control.cs
File metadata and controls
39 lines (38 loc) · 875 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
// Написать программу, которая выводит элементы массива длиной меньше чем 3 символа
Console.WriteLine("How many words would you like to enter?");
int n = Convert.ToInt32(Console.ReadLine());
string [] array = new string[n];
string [] b = new string[n];
for (int i =0 ; i< array.Length; i++ )
{
array[i]=Console.ReadLine();
}
Console.Write("[");
for (int i = 0; i < array.Length; i++)
{
Console.Write(array[i]);
if (i != array.Length-1)
{
Console.Write(", ");
}
}
Console.WriteLine("]");
int j = 0;
for (int i =0 ; i< array.Length; i++ )
{
if (array[i].Length<=3)
{
b[j] = array[i];
j++;
}
}
Console.Write("[");
for (int i = 0; i < j; i++)
{
Console.Write(b[i]);
if (i != j-1)
{
Console.Write(", ");
}
}
Console.Write("]");