text: Count set bits in an integer | C ++ program to demonstrate __builtin_popcount ( ) ; Driver code
code: #include <iostream> NEW_LINE using namespace std ; int main ( ) { cout << __builtin_popcount ( 4 ) << endl ; cout << __builtin_popcount ( 15 ) ; return 0 ; }