using System;
class massive {
static void Main() {
Random rnd = new Random();
int[] numbers = new int[50];
int positive = 0;
int negative = 0;
for(int i=0; i<50; i++)
{
numbers[i] = rnd.Next(-10, 10);
if(numbers[i] % 2 == 0)
positive ++;
else
negative ++;
}
Console.WriteLine("positive = " + positive);
Console.WriteLine("negative = " + negative);
Объяснение:
using System;
class massive {
static void Main() {
Random rnd = new Random();
int[] numbers = new int[50];
int positive = 0;
int negative = 0;
for(int i=0; i<50; i++)
{
numbers[i] = rnd.Next(-10, 10);
if(numbers[i] % 2 == 0)
positive ++;
else
negative ++;
}
Console.WriteLine("positive = " + positive);
Console.WriteLine("negative = " + negative);
}
}
Объяснение: