Created
July 25, 2015 07:23
-
-
Save MladenMladenov/13cb77e3e0be2a06439a to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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