Given a decimal number n without floating point. The problem is to convert the decimal number to octal number with minimum use of arithmetic operators.
Input : n = 10 Output : 12 12 is octal equivalent of decimal 10. Input : n = 151 Output : 227
Approach: Following are the steps:
- Perform decimal to binary conversion without using arithmetic operators of the given number n. Refer this post. Let this number be bin.
- Convert the binary number bin to octal. Refer this post.
Time Complexity: O(n), where n is the length of the binary string.
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 conversion without using arithmetic operators
- Program for Decimal to Octal Conversion
- Program for Octal to Decimal Conversion
- Check if Decimal representation of an Octal number is divisible by 7
- Program for Binary To Decimal Conversion
- Program for Decimal to Binary Conversion
- Case conversion (Lower to Upper and Vice Versa) of a string using BitWise operators in C/C++
- Convert a binary number to octal
- Program to Convert Hexadecimal to Octal
- Largest and Smallest N-digit Octal Numbers
- Largest N digit Octal number which is a Perfect square
- Octal equivalents of connected components in Binary valued graph
- Program to Convert Octal Number to Binary Number
- Prefix to Postfix Conversion
- Type Conversion in Python
- Postfix to Prefix Conversion
- Prefix to Infix Conversion
- BCD or Binary Coded Decimal
- BCD addition of given Decimal numbers
- Program for Hexadecimal to Decimal
If you like GeeksforGeeks and would like to contribute, you can also write an article using contribute.geeksforgeeks.org or mail your article to email@example.com. 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.
Improved By : Rajput-Ji