Professional Documents
Culture Documents
Ahihi
Ahihi
using System;
using System.Threading;
class Program
{
private static string s = ""; // Biến toàn cục để lưu chuỗi
private static bool isRunning = true; // Biến để kiểm tra xem chương trình có đang chạy hay không
// Chờ cả hai luồng kết thúc trước khi thoát chương trình
inputThread.Join();
readerThread.Join();
}
class Program
{
static int c = 1;
static bool check = false;
static void Main(string[] args)
{
// Bắt đầu hai luồng song song
Thread thread1 = new Thread(Function1);
Thread thread2 = new Thread(Function2);
thread1.Start();
thread2.Start();
thread1.Join();
thread2.Join();
}
check = false;
}
} while(c != 0);
Thread.Sleep(10); // Đợi 10ms
}
return true;
}
}
ĐẢO NGƯỢC CHUỖI ĐƯỢC NHẬP
using System;
using System.Threading;
class Program
{
static string inputString = string.Empty;
thread1.Start();
thread2.Start();
thread1.Join();
thread2.Join();
}
class Program
{
static string inputString = string.Empty;
thread1.Start();
thread2.Start();
thread1.Join();
thread2.Join();
}
class Program
{
static int n = -1;
static long result = -1;
thread1.Start();
thread2.Start();
thread1.Join();
thread2.Join();
}
result = CalculateFactorialRecursive(n);
Console.WriteLine($"{n}! = {result}");
}