Decimal to Octal Conversion Problem Statement

Convert a given decimal number into its equivalent octal representation.

Explanation:

The octal number system is a base-8 system, meaning each digit ranges from 0 to 7.

Input:

The first line contains a single integer 'T', the number of test cases.
The next 'T' lines each contain an integer 'X', the decimal number to be converted.

Output:

Print the octal value of 'X' for each test case on a new line.

Example:

Input:
3
10
20
65
Output:
12
24
101

Constraints:

  • 1 <= T <= 105
  • 0 <= X <= 109

Note: The input/output handling is already managed. You need to implement the function logic.

AnswerBot
5d

Convert a decimal number to its octal representation.

  • Understand the concept of octal number system (base-8)

  • Divide the decimal number by 8 and store the remainders to get the octal representation

  • Handle...read more

Help your peers!
Add answer anonymously...
MedTourEasy Software Developer Interview Questions
Stay ahead in your career. Get AmbitionBox app
qr-code
Helping over 1 Crore job seekers every month in choosing their right fit company
65 L+

Reviews

4 L+

Interviews

4 Cr+

Salaries

1 Cr+

Users/Month

Contribute to help millions

Made with ❤️ in India. Trademarks belong to their respective owners. All rights reserved © 2024 Info Edge (India) Ltd.

Follow us
  • Youtube
  • Instagram
  • LinkedIn
  • Facebook
  • Twitter