How Do I convert a number to a binary string?

namespace ToBinary

{

class Program

{

static void Main(string[] args)

{

int val = 51;

string binaryVal = Convert.ToString(val, 2);

Console.WriteLine("The value of {0} is {1}.", val, binaryVal);

Console.ReadLine();

}

}

}

Ebook Download
View all
Learn
View all