Untitled

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

class Program {
    static void Main(string[] args) {
        Thread t1 = new Thread(PrintNumbers);
        Thread t2 = new Thread(PrintNumbers);
        t1.Start(10);
        t2.Start(20);
        t1.Join();
        t2.Join();
        Console.ReadLine();
    }

    static void PrintNumbers(object startNum) {
        int n = (int)startNum;
        for (int i = n; i >= 1; i--) {
            Console.WriteLine(Thread.CurrentThread.Name + ": " + i);
            Thread.Sleep(100);
        }
    }
}