Here is a hint, this snippet converts decimal integer to binary using Stack, you just need to invert the process: -P
int num = 50;
Stack<int> stack = new Stack<int>();
while (num != 0)
{
stack.Push(num % 2);
num /= 2;
}
while (stack.Count > 0)
{
Console.Write(stack.Pop());
}
source
to share