The source code to get the number of processors of the current machine using Environment class is given below. The given program is compiled and executed successfully.
using System;
class Sample
{
//Entry point of Program
static public void Main()
{
int NumOfProcessor = 0;
NumOfProcessor = Environment.ProcessorCount;
Console.WriteLine("Number of Processor in current machine: " + NumOfProcessor);
}
}
Output:
Number of Processor in current machine: 4
Press any key to continue . . .
Program:
The source code to get the number of processors of the current machine using Environment class is given below. The given program is compiled and executed successfully.
Output: