Archived
1
0
This repository has been archived on 2026-03-24. You can view files and clone it. You cannot open issues or pull requests or push a commit.
Files
SomeLab/CS/lab10/10_2/Program.cs
2026-03-19 19:39:01 +08:00

30 lines
1.0 KiB
C#

using System.Collections;
namespace _10_2
{
internal class Program
{
static void Main(string[] args)
{
ArrayList redballs = new ArrayList() { 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 };
ArrayList blueballs = new ArrayList() { 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16 };
ArrayList redball = new ArrayList();
Random randobj = new Random();
int blueball=randobj.Next(1, 16);
for (int i = 0; i < 6; i++)
{
int index = randobj.Next(0, redballs.Count);
redball.Add(redballs[index]);
redballs.RemoveAt(index);
}
Console.WriteLine("Red Balls:");
foreach (var item in redball)
{
Console.Write(item + " ");
}
Console.WriteLine("\nBlue Ball:");
Console.WriteLine(blueball);
}
}
}