Skip to content

Instantly share code, notes, and snippets.

@MladenMladenov
Created July 25, 2015 07:23
Show Gist options
  • Save MladenMladenov/13cb77e3e0be2a06439a to your computer and use it in GitHub Desktop.
Save MladenMladenov/13cb77e3e0be2a06439a to your computer and use it in GitHub Desktop.
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
class DecToBin
{
static void Main()
{
long decNumber = long.Parse(Console.ReadLine());
string binNumber = "";
while (decNumber != 0)
{
int remain = (int)decNumber % 2;
decNumber /= 2;
binNumber = remain + binNumber;
}
Console.WriteLine(binNumber);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment