Bit Shift operator
using System;
class CompoundBitOpsApp
{
static void Main(string[] args)
{
for (byte j = 0; j < 8; j++)
{
byte k = 1;
Console.WriteLine(
"1 <<= {0,3} ({1}) = {2,8} ({3,3})",
Convert.ToString(j, 2), j,
Convert.ToString((k <<= j), 2), k);
}
}
}
Related examples in the same category