text: Decimal to Binary using recursion and without using power operator | C ++ implementation of the approach ; Recursive function to convert n to its binary equivalent ; Base case ; Recursive call ; Driver code
code: #include <bits/stdc++.h> NEW_LINE using namespace std ; void decimalToBinary ( int n ) { if ( n == 0 ) { cout << "0" ; return ; } decimalToBinary ( n / 2 ) ; cout << n % 2 ; } int main ( ) { int n = 13 ; decimalToBinary ( n ) ; return 0 ; }