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 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
- Program to Convert Octal Number to Binary Number
- Prefix to Infix Conversion
- Type Conversion in Python
- Postfix to Prefix Conversion
- Prefix to Postfix 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.