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 151 views
2 answers 269 views
1 answer 145 views
1 answer 141 views
1 answer 120 views
...