Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- namespace Decimal_to_Binary_Number
- {
- class DecimalToBinaryNumber
- {
- public static void Main(string[] args)
- {
- long dec = long.Parse(Console.ReadLine());
- string binElement = "";
- while (dec != 0)
- {
- int remain = (int) dec % 2;
- dec /= 2;
- binElement = remain + binElement;
- }
- Console.WriteLine(binElement);
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement