Given an integer N, the task is convert and print the binary equaiva;ent of N.
Input: N = 13
Input: N = 15
Approach Write a recursive function that takes an argument N and recursively calls itself with the value N / 2 as the new argument and prints N % 2 after the call. The base condition will be when N = 0, simply print 0 and return out of the function in that case.
Below is the implementation of the above approach:
Don’t stop now and take your learning to the next level. Learn all the important concepts of Data Structures and Algorithms with the help of the most trusted course: DSA Self Paced. Become industry ready at a student-friendly price.
- Decimal to binary number using recursion
- BCD or Binary Coded Decimal
- Convert Binary fraction to Decimal
- Program for Decimal to Binary Conversion
- Program for Binary To Decimal Conversion
- Recursive Program for Binary to Decimal
- Binary to Gray code using recursion
- Decimal to binary conversion without using arithmetic operators
- Decimal representation of given binary string is divisible by 10 or not
- Find Maximum Level Sum in Binary Tree using Recursion
- Find the node with maximum value in a Binary Search Tree using recursion
- Leaf nodes from Preorder of a Binary Search Tree (Using Recursion)
- Maximum decimal equivalent possible among all connected components of a Binary Valued Graph
- Minimum splits in a binary string such that every substring is a power of 4 or 6.
- Highest power of 2 that divides a number represented in binary
- Find maximum and minimum element in binary tree without using recursion or stack or queue
- Convert Decimal To Hexa-Decimal including negative numbers
- Operator Overloading '<<' and '>>' operator in a linked list class
- Find the sum of power of bit count raised to the power B
- Check if given number is a power of d where d is a power of 2
If you like GeeksforGeeks and would like to contribute, you can also write an article using contribute.geeksforgeeks.org or mail your article to firstname.lastname@example.org. See your article appearing on the GeeksforGeeks main page and help other Geeks.
Please Improve this article if you find anything incorrect by clicking on the "Improve Article" button below.