How to print the bits of an integer in 16 bit format with C#

1 Answer

0 votes
using System;

class Program
{
    static void Main() {
        int num = 17;
        
        Console.WriteLine(Convert.ToString(num, 2).PadLeft(16, '0'));
    }
}




/*
run:

0000000000010001

*/

 



answered Jan 9, 2023 by avibootz

Related questions

1 answer 119 views
1 answer 105 views
1 answer 139 views
2 answers 134 views
1 answer 113 views
...