Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- class Program
- {
- static void Main(string[] args)
- {
- int decNum = int.Parse(Console.ReadLine());
- string binNum = string.Empty;
- do
- {
- int bit = decNum % 2;
- binNum = bit + binNum;
- decNum /= 2;
- } while (decNum > 0);
- Console.WriteLine(binNum);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment