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

1 Answer

0 votes
using System;

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




/*
run:

00000000000000000000000010111101

*/

 



answered Jan 9, 2023 by avibootz

Related questions

1 answer 144 views
2 answers 261 views
1 answer 139 views
1 answer 130 views
1 answer 115 views
...