How to replace all zero bits with 1 bits


how to replace all 0 bits with 1
for ex in case of 9 :-1001
it should give output as :-1111

traverse using right shift and where comes 0 add that pow of 2 to your orignal ans @mohitshendre2609
i hope its clear if yes dont forget to mark it as resolved :smiley: