7
Answers

Two chevron

Maha

Maha

11y
1.9k
1
This program is given in the following website. Please explain the meaning of the two chevron mark. Problem is highlighted.
http://www.dotnetperls.com/binary-representation

using System;

class Program
{
static void Main()
{
// Write full binary string for 100.
Console.WriteLine(GetIntBinaryString(100));

// Write full binary string for 100000.
Console.WriteLine(GetIntBinaryString(100000));

Console.ReadKey();
}

static string GetIntBinaryString(int n)
{
char[] b = new char[32];
int pos = 31;
int i = 0;

while (i < 32)
{
if ((n & (1 << i)) != 0)
{
b[pos] = '1';
}
else
{
b[pos] = '0';
}
pos--;
i++;
}
return new string(b);
}
}
/*
00000000000000000000000001100100
00000000000000011000011010100000
*/

Answers (7)