Code Snippet to demonstrate Bitwise AND in C#

Below is a code snippet to demonstrate the Bitwise AND in C#

using System;

using System.Collections.Generic;

using System.Linq;

using System.Text;

using System.Threading.Tasks;

namespace ConsoleApplication1

{

internal class Program

{

private static void Main(string[] args)

{

// Equivalent to decimal 10

byte input1 = 0xA;

byte output;

System.Console.WriteLine("Input1 = " + input1);

output = (byte)(input1 & 2);

System.Console.WriteLine("Result = " + output);

Console.Read();

}

}

}
Code Snippet to demonstrate Bitwise AND in C#