Exercise
System Information
Objective
Create a program that shows specific system details, including the computer name, domain name, and the username of the user who is currently logged in.
Write Your C# Exercise
C# Exercise Example
// Import necessary namespaces for working with system information
using System;
class SystemInformation
{
// Main method where the program execution starts
static void Main()
{
// Display the name of the computer
Console.WriteLine("Computer Name: " + Environment.MachineName);
// Display the domain name (or "Workgroup" if not part of a domain)
Console.WriteLine("Domain Name: " + Environment.UserDomainName);
// Display the username of the currently logged-in user
Console.WriteLine("User Name: " + Environment.UserName);
}
}