C# programozási nyelven
int[] tomb1 = new int[25];
int asd = tomb1.Length;
Random rnd = new Random();
for (int i = 0; i < asd; i++)
{
tomb1[i] = rnd.Next(20, 61);
Console.WriteLine(tomb1[i]);
}
Console.WriteLine("========================");
int[] tomb2 = new int[asd];
int[] tomb3 = new int[asd];
int j = 0;
int k = 0;
for (int i = 0; i < asd; i++)
{
if (tomb1[i] < 30)
{
tomb2[j] = tomb1[i];
j++;
}
else
{
tomb3[k] = tomb1[i];
k++;
}
}
for (int i = 0; i < j; i++)
{
Console.WriteLine(tomb2[i]);
}
Console.WriteLine("=========================");
for (int i = 0; i < k; i++)
{
Console.WriteLine(tomb3[i]);
}
int[] tomb1 = new int[25];
int asd = tomb1.Length;
Random rnd = new Random();
for (int i = 0; i < asd; i++)
{
tomb1[i] = rnd.Next(20, 61);
Console.WriteLine(tomb1[i]);
}
Console.WriteLine("========================");
int[] tomb2 = new int[asd];
int[] tomb3 = new int[asd];
int j = 0;
int k = 0;
for (int i = 0; i < asd; i++)
{
if (tomb1[i] < 30)
{
tomb2[j] = tomb1[i];
j++;
}
else
{
tomb3[k] = tomb1[i];
k++;
}
}
for (int i = 0; i < j; i++)
{
Console.WriteLine(tomb2[i]);
}
Console.WriteLine("=========================");
for (int i = 0; i < k; i++)
{
Console.WriteLine(tomb3[i]);
}
Nincsenek megjegyzések:
Megjegyzés küldése