Skip to content

Commit d39a599

Browse files
get_or_remove_least_significant_bit.cpp
1 parent abf0e61 commit d39a599

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed
+9
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
#include <iostream>
2+
using namespace std;
3+
4+
int main() {
5+
int x = 6;
6+
cout << "remove " << x << "'s least significant bit: " << (x & (x-1)) << endl;
7+
cout << x << "'s least significant bit: " << (x & (~(x-1))) << endl;
8+
return 0;
9+
}

0 commit comments

Comments
 (0)