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.
- Decimal to binary conversion without using arithmetic operators
- Program for Octal to Decimal Conversion
- Program for Decimal to Octal Conversion
- Check if Decimal representation of an Octal number is divisible by 7
- Program for Decimal to Binary Conversion
- Program for Binary To Decimal Conversion
- Case conversion (Lower to Upper and Vice Versa) of a string using BitWise operators in C/C++
- Program to Convert Hexadecimal to Octal
- Convert a binary number to octal
- Program to Convert Octal Number to Binary Number
- Type Conversion in Python
- Prefix to Infix Conversion
- Prefix to Postfix Conversion
- Postfix to Prefix Conversion
- 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 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.
Improved By : Rajput-Ji