Generation

generate functionMon, 21 Nov 2022

converts any integer in the decimal number system to binary number system.

static string DecimalToBinary(int number) { int remainder; string result = string.Empty; while (number > 0) { remainder = number % 2; number /= 2; result = remainder.ToString() + result; } return result; } static void Main(string[] args) { Console.WriteLine(DecimalToBinary(15)); }

Questions about programming?Chat with your personal AI assistant