1
Answer

Decimal to Binary

Administrator

Administrator

22y
1.8k
1
how can I convert a decimal number to its binary counterpart? (Fro example decimal 10 means binary 1010 ). Thanks.
Answers (1)
0
Administrator
Admin 2.3k 1.3m 22y
Below is the solution using string conversion: decimal val = 10; string valbinary = Convert.ToString((int)val, 2); // this line converts to the base value decimal valoutput = Convert.ToDecimal(valbinary); Console.WriteLine(valoutput); Console.ReadLine(); -Mike G.