// Angel Zlatanov using System; using System.Collections.Generic; namespace ConsoleApp2 { class Program { static void Main(string[] args) { bool check; int integer1=0; do { check = true; Console.Write("\nМоля въведете число: "); string string1 = Console.ReadLine(); check = Int32.TryParse(string1, out integer1); } while (!check); List ostatuci = new List(); int counter = 0; do { if(integer1%2!=0) ostatuci.Add(1); else ostatuci.Add(0); integer1 = integer1 / 2; counter++; } while (integer1>=2); ostatuci.Add(1); counter++; Console.Write("Бинарно значение: "); for(int i=counter-1; i>=0; i--) Console.Write(ostatuci[i]); // Console.WriteLine("\nБинарно значение: " + Convert.ToString(integer1, 2)); // Console.WriteLine("\nHex: " + Convert.ToInt32(Convert.ToString(integer1, 2), 2).ToString("X")); Console.ReadKey(); } } }