Untitled

mail@pastecode.io avatar
unknown
plain_text
a year ago
976 B
0
Indexable
Never
using System;
using System.Threading;

class Program
{
    static void Main(string[] args)
    {
        Thread t1 = new Thread(() =>
        {
            for (int i = 0; i < 10; i++)
            {
                Console.WriteLine("A");
                Thread.Sleep(new Random().Next(1000, 2000));
            }
        });
        Thread t2 = new Thread(() =>
        {
            for (int i = 0; i < 10; i++)
            {
                Console.WriteLine("B");
                Thread.Sleep(new Random().Next(1000, 2000));
            }
        });
        Thread t3 = new Thread(() =>
        {
            for (int i = 0; i < 10; i++)
            {
                Console.WriteLine("C");
                Thread.Sleep(new Random().Next(1000, 2000));
            }
        });
        t1.Start();
        t2.Start();
        t3.Start();
        t1.Join();
        t2.Join();
        t3.Join();
        Console.ReadKey();
    }
}