Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- class DecimalToBinary
- {
- static void Main()
- {
- long dec = long.Parse(Console.ReadLine());
- long? remainder = null;
- string binary = null;
- while (dec > 0)
- {
- remainder = dec % 2;
- binary = remainder.ToString() + binary;
- dec /= 2;
- }
- Console.WriteLine(binary);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement