Binary representation of a given number | C ++ implementation of the approach ; Function to convert decimal to binary number ; Driver code
#include <bits/stdc++.h> NEW_LINE using namespace std ; void bin ( unsigned n ) { if ( n > 1 ) bin ( n >> 1 ) ; printf ( " % d " , n & 1 ) ; } int main ( void ) { bin ( 131 ) ; printf ( " STRNEWLINE " ) ; bin ( 3 ) ; return 0 ; }