CSharp - Write program to throw a coin once and check if it is Head or Tail

Requirements

You will write a program that throws a coin once.

Output if it is head or tail.

Hint

Generate a random number-zero or one-and convert it to heads or tails subsequently.

Next method requires the upper bound of a random number range to be augmented by 1.

Demo

using System;
class Program/*from  w  w  w. j a  v  a  2s .  c om*/
{
    static void Main(string[] args)
    {
        // Random number generator 
        Random randomNumbers = new Random();

        // Random number 0/1 and its transformation 
        int randomNumber = randomNumbers.Next(0, 1 + 1);
        if (randomNumber == 0)
        {
            Console.WriteLine("Head tossed");
        }
        else
        {
            Console.WriteLine("Tail tossed");
        }
    }
}

Result