Skip to main content

C# - 104

string p(int d){var r="";long i=1;while(r.Length<=64){var g=d&i;r=(g!=0)? "1"+r:"0"+r;i=i<<1;}return r;}

This method will convert decimal to binary up to 64 bits.

When executed the above method in Linqpad - rr = p(-32768); rr.Dump();

Output: 01111111111111111111111111111111111111111111111111000000000000000