using System.Collections.Generic;
using System.Threading.Tasks;
namespace _2_s_compliment
static void Main(string[] args)
Console.Write("Enter a positive integer: ");
if (sbyte.TryParse(Console.ReadLine(), out sbyte num))
Console.WriteLine("Binary representation: " + Convert.ToString(num, 2).PadLeft(8, '0'));
sbyte complement = (sbyte)(~num+1);
Console.WriteLine("Binary representation: " + Convert.ToString((byte)complement, 2).PadLeft(8, '0'));
Console.WriteLine("Decimal representation of negative: " + complement);