a | s | k
5,000000 | 0,000000 | 0,000000
9,000000 | 5,000000 | 1,000000
13,000000 | 14,000000 | 2,000000
17,000000 | 27,000000 | 3,000000
21,000000 | 44,000000 | 4,000000
25,000000 | 65,000000 | 5,000000
29,000000 | 90,000000 | 6,000000
33,000000 | 119,000000 | 7,000000
37,000000 | 152,000000 | 8,000000
41,000000 | 189,000000 | 9,000000
45,000000 | 230,000000 | 10,000000
49,000000 | 275,000000 | 11,000000
53,000000 | 324,000000 | 12,000000
K = 12.0
Language: C# , IDE: Visual Studio .
string CountString;
TryAgain:
Console.WriteLine("Введите количество элементов массива (от 2 до 100)");
CountString = Console.ReadLine();
if(! ( uint.TryParse(CountString, out uint Count) && Count <= 100 && Count >=2 ) )
{
Console.WriteLine("Введите корректное значение, попробуйте ёще раз.");
Console.ReadLine();
goto TryAgain;
}
var Array = new int[Count];
var ListForEven = new List<int>();
var Randomizer = new Random();
int RandomNumber;
for(int i = 0; i < Count; i++)
RandomNumber = Randomizer.Next(-1000, 1000);
Array[i] = RandomNumber;
foreach(int Even in Array)
if (Even % 2 == 0) ListForEven.Add(Even);
Console.WriteLine($"Максимальное чётное число из массива: {ListForEven.Max()}");
a | s | k
5,000000 | 0,000000 | 0,000000
9,000000 | 5,000000 | 1,000000
13,000000 | 14,000000 | 2,000000
17,000000 | 27,000000 | 3,000000
21,000000 | 44,000000 | 4,000000
25,000000 | 65,000000 | 5,000000
29,000000 | 90,000000 | 6,000000
33,000000 | 119,000000 | 7,000000
37,000000 | 152,000000 | 8,000000
41,000000 | 189,000000 | 9,000000
45,000000 | 230,000000 | 10,000000
49,000000 | 275,000000 | 11,000000
53,000000 | 324,000000 | 12,000000
K = 12.0
Language: C# , IDE: Visual Studio .
string CountString;
TryAgain:
Console.WriteLine("Введите количество элементов массива (от 2 до 100)");
CountString = Console.ReadLine();
if(! ( uint.TryParse(CountString, out uint Count) && Count <= 100 && Count >=2 ) )
{
Console.WriteLine("Введите корректное значение, попробуйте ёще раз.");
Console.ReadLine();
goto TryAgain;
}
var Array = new int[Count];
var ListForEven = new List<int>();
var Randomizer = new Random();
int RandomNumber;
for(int i = 0; i < Count; i++)
{
RandomNumber = Randomizer.Next(-1000, 1000);
Array[i] = RandomNumber;
}
foreach(int Even in Array)
{
if (Even % 2 == 0) ListForEven.Add(Even);
}
Console.WriteLine($"Максимальное чётное число из массива: {ListForEven.Max()}");
Console.ReadLine();